You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

49 lines
1.1 KiB

  1. #!/usr/bin/php5
  2. <?php
  3. /*
  4. * import libcaca importers test program
  5. * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com>
  6. *
  7. * This file is a Php port of "examples/import.c"
  8. * which is:
  9. * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.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. if($argc < 2)
  21. {
  22. die($argv[0] . ": missing argument (filename).\n" .
  23. "usage: " . $argv[0] . " <filename> [<format>]\n");
  24. }
  25. $cv = caca_create_canvas(0, 0);
  26. if(! $cv)
  27. {
  28. die("Can't create canvas\n");
  29. }
  30. if(caca_import_file($cv, $argv[1], $argc >= 3 ? $argv[2] : "") < 0)
  31. {
  32. die($argv[0] . ": could not open `" . $argv[1] . "'.\n");
  33. }
  34. $dp = caca_create_display($cv);
  35. if(! $dp)
  36. {
  37. die("Can't create display\n");
  38. }
  39. caca_refresh_display($dp);
  40. caca_get_event($dp, CACA_EVENT_KEY_PRESS, -1);
  41. ?>