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.

fullwidth.c 2.3 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 "cucul.h"
  19. #include "caca.h"
  20. #define CACA "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊"
  21. int main(int argc, char *argv[])
  22. {
  23. cucul_canvas_t *cv, *caca, *line;
  24. caca_display_t *dp;
  25. unsigned int i;
  26. cv = cucul_create_canvas(0, 0);
  27. if(cv == NULL)
  28. {
  29. printf("Can't created canvas\n");
  30. return -1;
  31. }
  32. dp = caca_create_display(cv);
  33. if(dp == NULL)
  34. {
  35. printf("Can't create display\n");
  36. return -1;
  37. }
  38. caca = cucul_create_canvas(6, 10);
  39. line = cucul_create_canvas(2, 1);
  40. /* Line of x's */
  41. for(i = 0; i < 10; i++)
  42. {
  43. cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE);
  44. cucul_put_str(caca, 0, i, CACA);
  45. cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_RED);
  46. cucul_put_char(caca, i - 2, i, 'x');
  47. }
  48. cucul_blit(cv, 1, 1, caca, NULL);
  49. /* Line of ホ's */
  50. for(i = 0; i < 10; i++)
  51. {
  52. cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE);
  53. cucul_put_str(caca, 0, i, CACA);
  54. cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_GREEN);
  55. cucul_put_str(caca, i - 2, i, "ホ");
  56. }
  57. cucul_blit(cv, 15, 1, caca, NULL);
  58. /* Line of canvas */
  59. cucul_set_color_ansi(line, CUCUL_WHITE, CUCUL_MAGENTA);
  60. cucul_put_str(line, 0, 0, "ほ");
  61. for(i = 0; i < 10; i++)
  62. {
  63. cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE);
  64. cucul_put_str(caca, 0, i, CACA);
  65. cucul_blit(caca, i - 2, i, line, NULL);
  66. }
  67. cucul_blit(cv, 29, 1, caca, NULL);
  68. caca_refresh_display(dp);
  69. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  70. caca_free_display(dp);
  71. cucul_free_canvas(line);
  72. cucul_free_canvas(caca);
  73. cucul_free_canvas(cv);
  74. return 0;
  75. }