您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

71 行
1.8 KiB

  1. /*
  2. * blit libcaca blit 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. # include <stdio.h>
  17. # include <string.h>
  18. #endif
  19. #include "cucul.h"
  20. #include "caca.h"
  21. static char const pig[] =
  22. " ,__ __,\n"
  23. " \\)`\\_..._/`(/\n"
  24. " .' _ _ '.\n"
  25. " / o\\ /o \\\n"
  26. " | .-.-. | _\n"
  27. " | /() ()\\ | (,`)\n"
  28. " / \\ '-----' / \\ .'\n"
  29. "| '-..___..-' |\n"
  30. "| |\n"
  31. "| |\n"
  32. "; ;\n"
  33. " \\ / \\ /\n"
  34. " \\-..-/'-'\\-..-/\n"
  35. "jgs\\/\\/ \\/\\/\n";
  36. int main(int argc, char *argv[])
  37. {
  38. cucul_canvas_t *cv, *sprite;
  39. caca_display_t *dp;
  40. cv = cucul_create_canvas(0, 0);
  41. dp = caca_create_display(cv);
  42. sprite = cucul_create_canvas(0, 0);
  43. cucul_set_color_ansi(sprite, CUCUL_LIGHTRED, CUCUL_BLACK);
  44. cucul_import_memory(sprite, pig, strlen(pig), "text");
  45. cucul_set_canvas_handle(sprite, cucul_get_canvas_width(sprite) / 2,
  46. cucul_get_canvas_height(sprite) / 2);
  47. cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE);
  48. cucul_put_str(cv, 0, 0, "Centered sprite");
  49. cucul_blit(cv, cucul_get_canvas_width(cv) / 2,
  50. cucul_get_canvas_height(cv) / 2, sprite, NULL);
  51. caca_refresh_display(dp);
  52. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  53. caca_free_display(dp);
  54. cucul_free_canvas(sprite);
  55. cucul_free_canvas(cv);
  56. return 0;
  57. }