Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

51 Zeilen
1.3 KiB

  1. #!/usr/bin/php5
  2. <?php
  3. /*
  4. * truecolor truecolor canvas features
  5. * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com>
  6. *
  7. * This file is a Php port of "examples/truecolor.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://sam.zoy.org/wtfpl/COPYING for more details.
  17. */
  18. if (php_sapi_name() != "cli") {
  19. die("You have to run this program with php-cli!\n");
  20. }
  21. $cv = caca_create_canvas(32, 16);
  22. if(!$cv) {
  23. die("Failed to create canvas\n");
  24. }
  25. $dp = caca_create_display($cv);
  26. if(!$dp) {
  27. die("Failed to create display\n");
  28. }
  29. for($y = 0; $y < 16; $y++)
  30. for($x = 0; $x < 16; $x++)
  31. {
  32. $bgcolor = 0xff00 | ($y << 4) | $x;
  33. $fgcolor = 0xf000 | ((15 - $y) << 4) | ((15 - $x) << 8);
  34. caca_set_color_argb($cv, $fgcolor, $bgcolor);
  35. caca_put_str($cv, $x * 2, $y, "CA");
  36. }
  37. caca_set_color_ansi($cv, CACA_WHITE, CACA_LIGHTBLUE);
  38. caca_put_str($cv, 2, 1, " truecolor libcaca ");
  39. caca_refresh_display($dp);
  40. caca_get_event($dp, CACA_EVENT_KEY_PRESS, -1);
  41. ?>