source: libcaca/trunk/caca-php/examples/fullwidth.php @ 3256

Last change on this file since 3256 was 3256, checked in by bsittler, 11 years ago

now works as PHP

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
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: fullwidth.php 3256 2008-11-03 22:18:27Z bsittler $
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
17define('CACA', "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊");
18
19$cv = caca_create_canvas(0, 0);
20if(! $cv)
21{
22        die("Can't created canvas\n");
23}
24$dp = caca_create_display($cv);
25if(! $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 */
34for($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
42caca_blit($cv, 1, 1, $caca);
43
44/* Line of ホ's */
45for($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
53caca_blit($cv, 15, 1, $caca);
54
55/* Line of canvas */
56caca_set_color_ansi($line, CACA_WHITE, CACA_MAGENTA);
57caca_put_str($line, 0, 0, "ほ");
58for($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
65caca_blit($cv, 29, 1, $caca);
66
67caca_refresh_display($dp);
68
69caca_get_event($dp, CACA_EVENT_KEY_PRESS, -1);
70
71?>
Note: See TracBrowser for help on using the repository browser.