您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

92 行
3.5 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. #if defined(HAVE_INTTYPES_H)
  15. # include <inttypes.h>
  16. #else
  17. typedef unsigned char uint8_t;
  18. typedef unsigned short uint16_t;
  19. typedef unsigned int uint32_t;
  20. #endif
  21. #include "cucul.h"
  22. #include "caca.h"
  23. int main(void)
  24. {
  25. cucul_t *qq;
  26. caca_t *kk;
  27. qq = cucul_init();
  28. kk = caca_attach(qq);
  29. cucul_set_color(qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE);
  30. cucul_putstr(qq, 1, 1, "Basic Unicode support");
  31. cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
  32. cucul_putstr(qq, 1, 2, "This is ASCII: [ abc DEF 123 !@# ]");
  33. cucul_putstr(qq, 1, 3, "This is Unicode: [ äβç ΔЗҒ ░▒▓ ♩♔✈ ]");
  34. cucul_putstr(qq, 1, 4, "If the two lines do not have the same length, there is a bug somewhere.");
  35. cucul_set_color(qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE);
  36. cucul_putstr(qq, 1, 6, "Gradient glyphs");
  37. cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
  38. cucul_putstr(qq, 31, 7, " 0%");
  39. cucul_putstr(qq, 31, 8, " 25%");
  40. cucul_putstr(qq, 31, 9, " 50%");
  41. cucul_putstr(qq, 31, 10, " 75%");
  42. cucul_putstr(qq, 31, 11, "100%");
  43. cucul_set_color(qq, CUCUL_COLOR_RED, CUCUL_COLOR_CYAN);
  44. cucul_putstr(qq, 1, 7, " ");
  45. cucul_putstr(qq, 1, 8, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░");
  46. cucul_putstr(qq, 1, 9, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒");
  47. cucul_putstr(qq, 1, 10, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓");
  48. cucul_putstr(qq, 1, 11, "█████████████████████████████");
  49. cucul_set_color(qq, CUCUL_COLOR_CYAN, CUCUL_COLOR_RED);
  50. cucul_putstr(qq, 36, 7, "█████████████████████████████");
  51. cucul_putstr(qq, 36, 8, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓");
  52. cucul_putstr(qq, 36, 9, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒");
  53. cucul_putstr(qq, 36, 10, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░");
  54. cucul_putstr(qq, 36, 11, " ");
  55. cucul_set_color(qq, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE);
  56. cucul_putstr(qq, 1, 13, "Double width characters");
  57. cucul_set_color(qq, CUCUL_COLOR_LIGHTRED, CUCUL_COLOR_BLACK);
  58. cucul_putstr(qq, 1, 14, "ドラゴン ボーレ |");
  59. cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
  60. cucul_putstr(qq, 1, 15, "()()()() ()()() |");
  61. cucul_set_color(qq, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK);
  62. cucul_putstr(qq, 1, 16, "ドラゴン");
  63. cucul_putstr(qq, 10, 16, "ボーレ |");
  64. cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
  65. cucul_putstr(qq, 1, 17, "If the three lines do not have the same length, there is a bug somewhere.");
  66. caca_display(kk);
  67. while(!caca_get_event(kk, CACA_EVENT_KEY_PRESS));
  68. caca_detach(kk);
  69. cucul_end(qq);
  70. return 0;
  71. }