選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

58 行
1.2 KiB

  1. #!/usr/bin/php5
  2. <?
  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. echo caca_export_string($cv, "utf8");
  27. }
  28. just_for_fun();
  29. //--- Show caca's information ---//
  30. echo "libcaca version: ".caca_get_version()."\n\n";
  31. echo "Available drivers:\n";
  32. $list = caca_get_display_driver_list();
  33. foreach($list as $type => $name)
  34. echo "* $name ($type)\n";
  35. echo "\n";
  36. echo "Available export modules:\n";
  37. $list = caca_get_export_list();
  38. foreach($list as $type => $name)
  39. echo "* $name ($type)\n";
  40. echo "\n";
  41. echo "Available caca fonts:\n";
  42. $list = caca_get_font_list();
  43. foreach($list as $name)
  44. echo "* $name\n";
  45. echo "\n";