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.
 
 
 
 
 
 

122 lines
3.3 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. #if defined(HAVE_INTTYPES_H)
  15. # include <inttypes.h>
  16. #else
  17. typedef unsigned char uint8_t;
  18. typedef unsigned short uint16_t;
  19. typedef unsigned int uint32_t;
  20. #endif
  21. #include <stdio.h>
  22. #include "cucul.h"
  23. #include "caca.h"
  24. static char const *pig[] =
  25. {
  26. ",--. ,--.",
  27. "\\ /-~-\\ /",
  28. " )' o O `(",
  29. "( ,---. )",
  30. " `(_o_o_)'",
  31. " )`-'(",
  32. NULL
  33. };
  34. static char const *duck[] =
  35. {
  36. " ,~~.",
  37. " __ , ( O )>",
  38. "___( o)> )`~~' (",
  39. "\\ <_. ) ( .__) )",
  40. " `---' `-.____,'",
  41. NULL
  42. };
  43. int main(void)
  44. {
  45. cucul_canvas_t *cv, *normal, *flip, *flop, *rotate;
  46. caca_display_t *dp;
  47. int i;
  48. cv = cucul_create_canvas(0, 0);
  49. dp = caca_create_display(cv);
  50. normal = cucul_create_canvas(70, 6);
  51. flip = cucul_create_canvas(70, 6);
  52. flop = cucul_create_canvas(70, 6);
  53. rotate = cucul_create_canvas(70, 6);
  54. cucul_set_color(normal, CUCUL_COLOR_LIGHTMAGENTA, CUCUL_COLOR_BLACK);
  55. for(i = 0; pig[i]; i++)
  56. cucul_putstr(normal, 55, i, pig[i]);
  57. cucul_set_color(normal, CUCUL_COLOR_LIGHTGREEN, CUCUL_COLOR_BLACK);
  58. for(i = 0; duck[i]; i++)
  59. cucul_putstr(normal, 30, 1 + i, duck[i]);
  60. cucul_set_color(normal, CUCUL_COLOR_LIGHTCYAN, CUCUL_COLOR_BLACK);
  61. cucul_putstr(normal, 1, 1, "hahaha mais vieux porc immonde !!");
  62. cucul_set_color(normal, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK);
  63. cucul_putstr(normal, 4, 2, "\\o\\ \\o| _o/ \\o_ |o/ /o/");
  64. cucul_set_color(normal, CUCUL_COLOR_WHITE, CUCUL_COLOR_LIGHTRED);
  65. cucul_putstr(normal, 7, 3, "▙▘▌▙▘▞▖▞▖▌ ▞▖▌ ▌▌");
  66. cucul_putstr(normal, 7, 4, "▛▖▌▛▖▚▘▚▘▚▖▚▘▚▖▖▖");
  67. cucul_set_color(normal, CUCUL_COLOR_BLACK, CUCUL_COLOR_LIGHTRED);
  68. cucul_putstr(normal, 4, 3, "▓▒░");
  69. cucul_putstr(normal, 4, 4, "▓▒░");
  70. cucul_putstr(normal, 24, 3, "░▒▓");
  71. cucul_putstr(normal, 24, 4, "░▒▓");
  72. /* Flip, flop and rotate our working canvas */
  73. cucul_blit(flip, 0, 0, normal, NULL);
  74. cucul_flip(flip);
  75. cucul_blit(flop, 0, 0, normal, NULL);
  76. cucul_flop(flop);
  77. cucul_blit(rotate, 0, 0, normal, NULL);
  78. cucul_rotate(rotate);
  79. /* Blit the transformed canvas onto the main canvas */
  80. cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE);
  81. cucul_putstr(cv, 0, 0, "normal");
  82. cucul_blit(cv, 10, 0, normal, NULL);
  83. cucul_putstr(cv, 0, 6, "flip");
  84. cucul_blit(cv, 10, 6, flip, NULL);
  85. cucul_putstr(cv, 0, 12, "flop");
  86. cucul_blit(cv, 10, 12, flop, NULL);
  87. cucul_putstr(cv, 0, 18, "rotate");
  88. cucul_blit(cv, 10, 18, rotate, NULL);
  89. caca_refresh_display(dp);
  90. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  91. caca_free_display(dp);
  92. cucul_free_canvas(rotate);
  93. cucul_free_canvas(flop);
  94. cucul_free_canvas(flip);
  95. cucul_free_canvas(normal);
  96. cucul_free_canvas(cv);
  97. return 0;
  98. }