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.

fullwidth.c 2.4 KiB

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