| 1 | #!/usr/bin/php5 |
|---|
| 2 | <?php |
|---|
| 3 | /* |
|---|
| 4 | * fullwidth libcaca fullwidth Unicode characters test program |
|---|
| 5 | * Copyright (c) 2006 Sam Hocevar <sam@zoy.org> |
|---|
| 6 | * All Rights Reserved |
|---|
| 7 | * |
|---|
| 8 | * $Id$ |
|---|
| 9 | * |
|---|
| 10 | * This program is free software. It comes without any warranty, to |
|---|
| 11 | * the extent permitted by applicable law. You can redistribute it |
|---|
| 12 | * and/or modify it under the terms of the Do What The Fuck You Want |
|---|
| 13 | * To Public License, Version 2, as published by Sam Hocevar. See |
|---|
| 14 | * http://sam.zoy.org/wtfpl/COPYING for more details. |
|---|
| 15 | */ |
|---|
| 16 | |
|---|
| 17 | define('CACA', "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊"); |
|---|
| 18 | |
|---|
| 19 | $cv = caca_create_canvas(0, 0); |
|---|
| 20 | if(! $cv) |
|---|
| 21 | { |
|---|
| 22 | die("Can't created canvas\n"); |
|---|
| 23 | } |
|---|
| 24 | $dp = caca_create_display($cv); |
|---|
| 25 | if(! $dp) |
|---|
| 26 | { |
|---|
| 27 | die("Can't create display\n"); |
|---|
| 28 | } |
|---|
| 29 | |
|---|
| 30 | $caca = caca_create_canvas(6, 10); |
|---|
| 31 | $line = caca_create_canvas(2, 1); |
|---|
| 32 | |
|---|
| 33 | /* Line of x's */ |
|---|
| 34 | for($i = 0; $i < 10; $i++) |
|---|
| 35 | { |
|---|
| 36 | caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); |
|---|
| 37 | caca_put_str($caca, 0, $i, CACA); |
|---|
| 38 | caca_set_color_ansi($caca, CACA_WHITE, CACA_RED); |
|---|
| 39 | caca_put_char($caca, $i - 2, $i, ord('x')); |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | caca_blit($cv, 1, 1, $caca); |
|---|
| 43 | |
|---|
| 44 | /* Line of ホ's */ |
|---|
| 45 | for($i = 0; $i < 10; $i++) |
|---|
| 46 | { |
|---|
| 47 | caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); |
|---|
| 48 | caca_put_str($caca, 0, $i, CACA); |
|---|
| 49 | caca_set_color_ansi($caca, CACA_WHITE, CACA_GREEN); |
|---|
| 50 | caca_put_str($caca, $i - 2, $i, "ホ"); |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | caca_blit($cv, 15, 1, $caca); |
|---|
| 54 | |
|---|
| 55 | /* Line of canvas */ |
|---|
| 56 | caca_set_color_ansi($line, CACA_WHITE, CACA_MAGENTA); |
|---|
| 57 | caca_put_str($line, 0, 0, "ほ"); |
|---|
| 58 | for($i = 0; $i < 10; $i++) |
|---|
| 59 | { |
|---|
| 60 | caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE); |
|---|
| 61 | caca_put_str($caca, 0, $i, CACA); |
|---|
| 62 | caca_blit($caca, $i - 2, $i, $line); |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | caca_blit($cv, 29, 1, $caca); |
|---|
| 66 | |
|---|
| 67 | caca_refresh_display($dp); |
|---|
| 68 | |
|---|
| 69 | caca_get_event($dp, CACA_EVENT_KEY_PRESS, -1); |
|---|
| 70 | |
|---|
| 71 | ?> |
|---|