Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

103 righe
4.6 KiB

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