Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

78 righe
1.9 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@hocevar.net>
  10. * All Rights Reserved
  11. *
  12. * This program is free software. It comes without any warranty, to
  13. * the extent permitted by applicable law. You can redistribute it
  14. * and/or modify it under the terms of the Do What the Fuck You Want
  15. * to Public License, Version 2, as published by Sam Hocevar. See
  16. * http://www.wtfpl.net/ for more details.
  17. */
  18. if (php_sapi_name() != "cli") {
  19. die("You have to run this program with php-cli!\n");
  20. }
  21. define('CACA', "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊");
  22. $cv = caca_create_canvas(0, 0);
  23. if(! $cv)
  24. {
  25. die("Can't created canvas\n");
  26. }
  27. $dp = caca_create_display($cv);
  28. if(! $dp)
  29. {
  30. die("Can't create display\n");
  31. }
  32. $caca = caca_create_canvas(6, 10);
  33. $line = caca_create_canvas(2, 1);
  34. /* Line of x's */
  35. for($i = 0; $i < 10; $i++)
  36. {
  37. caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE);
  38. caca_put_str($caca, 0, $i, CACA);
  39. caca_set_color_ansi($caca, CACA_WHITE, CACA_RED);
  40. caca_put_char($caca, $i - 2, $i, ord('x'));
  41. }
  42. caca_blit($cv, 1, 1, $caca);
  43. /* Line of ホ's */
  44. for($i = 0; $i < 10; $i++)
  45. {
  46. caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE);
  47. caca_put_str($caca, 0, $i, CACA);
  48. caca_set_color_ansi($caca, CACA_WHITE, CACA_GREEN);
  49. caca_put_str($caca, $i - 2, $i, "ホ");
  50. }
  51. caca_blit($cv, 15, 1, $caca);
  52. /* Line of canvas */
  53. caca_set_color_ansi($line, CACA_WHITE, CACA_MAGENTA);
  54. caca_put_str($line, 0, 0, "ほ");
  55. for($i = 0; $i < 10; $i++)
  56. {
  57. caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE);
  58. caca_put_str($caca, 0, $i, CACA);
  59. caca_blit($caca, $i - 2, $i, $line);
  60. }
  61. caca_blit($cv, 29, 1, $caca);
  62. caca_refresh_display($dp);
  63. caca_get_event($dp, CACA_EVENT_KEY_PRESS, -1);
  64. ?>