Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

fullwidth.c 2.2 KiB

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