Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

68 rindas
1.5 KiB

  1. #!/usr/bin/php5
  2. <?php
  3. //--- Just for fun ---//
  4. function just_for_fun() {
  5. $moo = <<<EOT
  6. (__)
  7. (oo)
  8. /------\/
  9. / | ||
  10. * /\---/\
  11. ~~ ~~
  12. EOT;
  13. $cv = caca_create_canvas(0, 0);
  14. caca_set_color_ansi($cv, CACA_LIGHTBLUE, CACA_DEFAULT);
  15. caca_import_string($cv, $moo, "text");
  16. for($j = 0; $j < caca_get_canvas_height($cv); $j++) {
  17. for($i = 0; $i < caca_get_canvas_width($cv); $i += 2) {
  18. caca_set_color_ansi($cv, (caca_rand(1, 10) > 5 ? CACA_LIGHTBLUE : CACA_WHITE), CACA_DEFAULT);
  19. $a = caca_get_attr($cv, -1, -1);
  20. caca_put_attr($cv, $i, $j, $a);
  21. caca_put_attr($cv, $i + 1, $j, $a);
  22. }
  23. }
  24. caca_set_color_ansi($cv, CACA_LIGHTGREEN, CACA_DEFAULT);
  25. caca_put_str($cv, 8, 0, "Moo!");
  26. caca_set_color_ansi($cv, CACA_LIGHTRED, CACA_DEFAULT);
  27. caca_put_char($cv, 8, 1, hexdec("2765")); //U+2765
  28. caca_put_char($cv, 10, 1, hexdec("2764")); //U+2764
  29. echo caca_export_string($cv, "utf8");
  30. }
  31. just_for_fun();
  32. //--- Show caca's information ---//
  33. echo "libcaca version: ".caca_get_version()."\n\n";
  34. echo "Available drivers:\n";
  35. $list = caca_get_display_driver_list();
  36. foreach($list as $type => $name)
  37. echo "* $name ($type)\n";
  38. echo "\n";
  39. echo "Available import formats:\n";
  40. $list = caca_get_import_list();
  41. foreach($list as $format => $name)
  42. echo "* $name ($format)\n";
  43. echo "\n";
  44. echo "Available export formats:\n";
  45. $list = caca_get_export_list();
  46. foreach($list as $format => $name)
  47. echo "* $name ($format)\n";
  48. echo "\n";
  49. echo "Available caca fonts:\n";
  50. $list = caca_get_font_list();
  51. foreach($list as $name)
  52. echo "* $name\n";
  53. echo "\n";
  54. ?>