Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

76 rader
1.8 KiB

  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$
  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. define('CACA', "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊");
  21. $cv = caca_create_canvas(0, 0);
  22. if(! $cv)
  23. {
  24. die("Can't created canvas\n");
  25. }
  26. $dp = caca_create_display($cv);
  27. if(! $dp)
  28. {
  29. die("Can't create display\n");
  30. }
  31. $caca = caca_create_canvas(6, 10);
  32. $line = caca_create_canvas(2, 1);
  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. caca_blit($cv, 1, 1, $caca);
  42. /* Line of ホ's */
  43. for($i = 0; $i < 10; $i++)
  44. {
  45. caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE);
  46. caca_put_str($caca, 0, $i, CACA);
  47. caca_set_color_ansi($caca, CACA_WHITE, CACA_GREEN);
  48. caca_put_str($caca, $i - 2, $i, "ホ");
  49. }
  50. caca_blit($cv, 15, 1, $caca);
  51. /* Line of canvas */
  52. caca_set_color_ansi($line, CACA_WHITE, CACA_MAGENTA);
  53. caca_put_str($line, 0, 0, "ほ");
  54. for($i = 0; $i < 10; $i++)
  55. {
  56. caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE);
  57. caca_put_str($caca, 0, $i, CACA);
  58. caca_blit($caca, $i - 2, $i, $line);
  59. }
  60. caca_blit($cv, 29, 1, $caca);
  61. caca_refresh_display($dp);
  62. caca_get_event($dp, CACA_EVENT_KEY_PRESS, -1);
  63. ?>