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

Last change on this file since 3267 was 3257, checked in by bsittler, 12 years ago

added copyright info for PHP conversion (blah blah blah...)

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