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.
 
 
 
 
 
 

74 lines
1.9 KiB

  1. /*
  2. * unicode libcaca Unicode rendering test program
  3. * Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the Do What The Fuck You Want To
  10. * Public License, Version 2, as published by Sam Hocevar. See
  11. * http://sam.zoy.org/wtfpl/COPYING for more details.
  12. */
  13. #include "config.h"
  14. #include "common.h"
  15. #if !defined(__KERNEL__)
  16. # if defined(HAVE_INTTYPES_H)
  17. # include <inttypes.h>
  18. # endif
  19. # include <stdio.h>
  20. # include <string.h>
  21. #endif
  22. #include "cucul.h"
  23. #include "caca.h"
  24. static char const pig[] =
  25. " ,__ __,\n"
  26. " \\)`\\_..._/`(/\n"
  27. " .' _ _ '.\n"
  28. " / o\\ /o \\\n"
  29. " | .-.-. | _\n"
  30. " | /() ()\\ | (,`)\n"
  31. " / \\ '-----' / \\ .'\n"
  32. "| '-..___..-' |\n"
  33. "| |\n"
  34. "| |\n"
  35. "; ;\n"
  36. " \\ / \\ /\n"
  37. " \\-..-/'-'\\-..-/\n"
  38. "jgs\\/\\/ \\/\\/\n";
  39. int main(int argc, char *argv[])
  40. {
  41. cucul_canvas_t *cv, *sprite;
  42. caca_display_t *dp;
  43. cv = cucul_create_canvas(0, 0);
  44. dp = caca_create_display(cv);
  45. sprite = cucul_create_canvas(0, 0);
  46. cucul_set_color_ansi(sprite, CUCUL_LIGHTRED, CUCUL_BLACK);
  47. cucul_import_memory(sprite, pig, strlen(pig), "text");
  48. cucul_set_canvas_handle(sprite, cucul_get_canvas_width(sprite) / 2,
  49. cucul_get_canvas_height(sprite) / 2);
  50. cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE);
  51. cucul_put_str(cv, 0, 0, "Centered sprite");
  52. cucul_blit(cv, cucul_get_canvas_width(cv) / 2,
  53. cucul_get_canvas_height(cv) / 2, sprite, NULL);
  54. caca_refresh_display(dp);
  55. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  56. caca_free_display(dp);
  57. cucul_free_canvas(sprite);
  58. cucul_free_canvas(cv);
  59. return 0;
  60. }