Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

95 wiersze
2.2 KiB

  1. /*
  2. * fullwidth libcaca fullwidth Unicode characters 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. It comes without any warranty, to
  9. * the extent permitted by applicable law. You can redistribute it
  10. * and/or modify it under the terms of the Do What The Fuck You Want
  11. * To Public License, Version 2, as published by Sam Hocevar. See
  12. * http://sam.zoy.org/wtfpl/COPYING for more details.
  13. */
  14. #include "config.h"
  15. #if !defined(__KERNEL__)
  16. # include <stdio.h>
  17. #endif
  18. #include "caca.h"
  19. #define CACA "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊"
  20. int main(int argc, char *argv[])
  21. {
  22. caca_canvas_t *cv, *caca, *line;
  23. caca_display_t *dp;
  24. unsigned int i;
  25. cv = caca_create_canvas(0, 0);
  26. if(cv == NULL)
  27. {
  28. printf("Can't created canvas\n");
  29. return -1;
  30. }
  31. dp = caca_create_display(cv);
  32. if(dp == NULL)
  33. {
  34. printf("Can't create display\n");
  35. return -1;
  36. }
  37. caca = caca_create_canvas(6, 10);
  38. line = caca_create_canvas(2, 1);
  39. /* Line of x's */
  40. for(i = 0; i < 10; i++)
  41. {
  42. caca_set_color_ansi(caca, CACA_WHITE, CACA_BLUE);
  43. caca_put_str(caca, 0, i, CACA);
  44. caca_set_color_ansi(caca, CACA_WHITE, CACA_RED);
  45. caca_put_char(caca, i - 2, i, 'x');
  46. }
  47. caca_blit(cv, 1, 1, caca, NULL);
  48. /* Line of ホ's */
  49. for(i = 0; i < 10; i++)
  50. {
  51. caca_set_color_ansi(caca, CACA_WHITE, CACA_BLUE);
  52. caca_put_str(caca, 0, i, CACA);
  53. caca_set_color_ansi(caca, CACA_WHITE, CACA_GREEN);
  54. caca_put_str(caca, i - 2, i, "ホ");
  55. }
  56. caca_blit(cv, 15, 1, caca, NULL);
  57. /* Line of canvas */
  58. caca_set_color_ansi(line, CACA_WHITE, CACA_MAGENTA);
  59. caca_put_str(line, 0, 0, "ほ");
  60. for(i = 0; i < 10; i++)
  61. {
  62. caca_set_color_ansi(caca, CACA_WHITE, CACA_BLUE);
  63. caca_put_str(caca, 0, i, CACA);
  64. caca_blit(caca, i - 2, i, line, NULL);
  65. }
  66. caca_blit(cv, 29, 1, caca, NULL);
  67. caca_refresh_display(dp);
  68. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  69. caca_free_display(dp);
  70. caca_free_canvas(line);
  71. caca_free_canvas(caca);
  72. caca_free_canvas(cv);
  73. return 0;
  74. }