No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

105 líneas
4.6 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. 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. int main(int argc, char *argv[])
  20. {
  21. caca_canvas_t *cv;
  22. caca_display_t *dp;
  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_set_color_ansi(cv, CACA_WHITE, CACA_BLUE);
  36. caca_put_str(cv, 1, 1, "Basic Unicode support");
  37. caca_set_color_ansi(cv, CACA_DEFAULT, CACA_TRANSPARENT);
  38. caca_put_str(cv, 1, 2, "This is ASCII: | abc DEF 123 !@# |");
  39. caca_put_str(cv, 1, 3, "This is Unicode: | äßç δεφ ☺♥♀ ╞╬╗ |");
  40. caca_put_str(cv, 1, 4, "And this is, too: | ἀβϛ ΔЗҒ ᚴᛒᛯ ♩♔✈ |");
  41. caca_put_str(cv, 41, 4, "Size test: 018adxmygWX'_ÍçÕĔŷ ﻙ が本");
  42. caca_put_str(cv, 1, 5, "If the three lines do not have the same length, there is a bug somewhere.");
  43. caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE);
  44. caca_put_str(cv, 1, 7, "Gradient glyphs");
  45. caca_set_color_ansi(cv, CACA_DEFAULT, CACA_TRANSPARENT);
  46. caca_put_str(cv, 31, 8, " 0%");
  47. caca_put_str(cv, 31, 9, " 25%");
  48. caca_put_str(cv, 31, 10, " 50%");
  49. caca_put_str(cv, 31, 11, " 75%");
  50. caca_put_str(cv, 31, 12, "100%");
  51. caca_set_color_ansi(cv, CACA_LIGHTRED, CACA_LIGHTGREEN);
  52. caca_put_str(cv, 1, 8, " ");
  53. caca_put_str(cv, 1, 9, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░");
  54. caca_put_str(cv, 1, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒");
  55. caca_put_str(cv, 1, 11, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓");
  56. caca_put_str(cv, 1, 12, "█████████████████████████████");
  57. caca_set_color_ansi(cv, CACA_LIGHTGREEN, CACA_LIGHTRED);
  58. caca_put_str(cv, 36, 8, "█████████████████████████████");
  59. caca_put_str(cv, 36, 9, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓");
  60. caca_put_str(cv, 36, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒");
  61. caca_put_str(cv, 36, 11, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░");
  62. caca_put_str(cv, 36, 12, " ");
  63. caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE);
  64. caca_put_str(cv, 1, 14, "Double width characters");
  65. caca_set_color_ansi(cv, CACA_LIGHTRED, CACA_TRANSPARENT);
  66. caca_put_str(cv, 1, 15, "| ドラゴン ボーレ |");
  67. caca_set_color_ansi(cv, CACA_DEFAULT, CACA_TRANSPARENT);
  68. caca_put_str(cv, 1, 16, "| ()()()() ()()() |");
  69. caca_set_color_ansi(cv, CACA_YELLOW, CACA_TRANSPARENT);
  70. caca_put_str(cv, 1, 17, "| ドラゴン");
  71. caca_put_str(cv, 12, 17, "ボーレ |");
  72. caca_set_color_ansi(cv, CACA_DEFAULT, CACA_TRANSPARENT);
  73. caca_put_str(cv, 1, 18, "If the three lines do not have the same length, there is a bug somewhere.");
  74. caca_put_str(cv, 1, 20, "CP437 glyphs: ☺ ☻ ♥ ♦ ♣ ♠ • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼ ► ◄ ↕ ‼ ¶ § ▬ ↨ ↑ ↓ → ← ∟ ↔ ▲ ▼");
  75. caca_put_str(cv, 1, 21, "more CP437: α ß Γ π Σ σ µ τ Φ Θ Ω δ ∞ φ ε ∩ ≡ ± ≥ ≤ ⌠ ⌡ ÷ ≈ ° ∙ · √ ⁿ ² ■");
  76. caca_put_str(cv, 1, 22, "drawing blocks: ███ ▓▓▓ ▒▒▒ ░░░ ▀ ▄ ▌ ▐ █ ▖ ▗ ▘ ▝ ▚ ▞ ▙ ▛ ▜ ▟ ─ │ ┌ ┐ └ ┘ ├ ┤");
  77. caca_put_str(cv, 1, 23, "more drawing: ┬ ┴ ┼ ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟ ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬");
  78. caca_put_str(cv, 1, 24, "misc Unicode: ● ☭ ☮ ☯ ♔ ♛ ♙ ♞ ⚒ ⚓ ⚠");
  79. caca_refresh_display(dp);
  80. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  81. caca_free_display(dp);
  82. caca_free_canvas(cv);
  83. return 0;
  84. }