Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

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