Changeset 2821 for libcaca/trunk/examples/unicode.c
- Timestamp:
- Sep 27, 2008, 3:12:46 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/examples/unicode.c
r2299 r2821 19 19 #endif 20 20 21 #include "cucul.h"22 21 #include "caca.h" 23 22 24 23 int main(int argc, char *argv[]) 25 24 { 26 c ucul_canvas_t *cv;25 caca_canvas_t *cv; 27 26 caca_display_t *dp; 28 27 29 cv = c ucul_create_canvas(0, 0);28 cv = caca_create_canvas(0, 0); 30 29 if(cv == NULL) 31 30 { … … 39 38 return -1; 40 39 } 41 c ucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE);42 c ucul_put_str(cv, 1, 1, "Basic Unicode support");40 caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); 41 caca_put_str(cv, 1, 1, "Basic Unicode support"); 43 42 44 c ucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT);45 c ucul_put_str(cv, 1, 2, "This is ASCII: | abc DEF 123 !@# |");46 c ucul_put_str(cv, 1, 3, "This is Unicode: | äßç δεφ ☺♥♀ ╞╬╗ |");47 c ucul_put_str(cv, 1, 4, "And this is, too: | ἀβϛ ΔЗҒ ᚴᛒᛯ ♩♔✈ |");43 caca_set_color_ansi(cv, CACA_DEFAULT, CACA_TRANSPARENT); 44 caca_put_str(cv, 1, 2, "This is ASCII: | abc DEF 123 !@# |"); 45 caca_put_str(cv, 1, 3, "This is Unicode: | äßç δεφ ☺♥♀ ╞╬╗ |"); 46 caca_put_str(cv, 1, 4, "And this is, too: | ἀβϛ ΔЗҒ ᚴᛒᛯ ♩♔✈ |"); 48 47 49 c ucul_put_str(cv, 1, 5, "If the three lines do not have the same length, there is a bug somewhere.");48 caca_put_str(cv, 1, 5, "If the three lines do not have the same length, there is a bug somewhere."); 50 49 51 c ucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE);52 c ucul_put_str(cv, 1, 7, "Gradient glyphs");50 caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); 51 caca_put_str(cv, 1, 7, "Gradient glyphs"); 53 52 54 c ucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT);55 c ucul_put_str(cv, 31, 8, " 0%");56 c ucul_put_str(cv, 31, 9, " 25%");57 c ucul_put_str(cv, 31, 10, " 50%");58 c ucul_put_str(cv, 31, 11, " 75%");59 c ucul_put_str(cv, 31, 12, "100%");53 caca_set_color_ansi(cv, CACA_DEFAULT, CACA_TRANSPARENT); 54 caca_put_str(cv, 31, 8, " 0%"); 55 caca_put_str(cv, 31, 9, " 25%"); 56 caca_put_str(cv, 31, 10, " 50%"); 57 caca_put_str(cv, 31, 11, " 75%"); 58 caca_put_str(cv, 31, 12, "100%"); 60 59 61 c ucul_set_color_ansi(cv, CUCUL_LIGHTRED, CUCUL_LIGHTGREEN);62 c ucul_put_str(cv, 1, 8, " ");63 c ucul_put_str(cv, 1, 9, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░");64 c ucul_put_str(cv, 1, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒");65 c ucul_put_str(cv, 1, 11, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓");66 c ucul_put_str(cv, 1, 12, "█████████████████████████████");60 caca_set_color_ansi(cv, CACA_LIGHTRED, CACA_LIGHTGREEN); 61 caca_put_str(cv, 1, 8, " "); 62 caca_put_str(cv, 1, 9, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); 63 caca_put_str(cv, 1, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"); 64 caca_put_str(cv, 1, 11, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"); 65 caca_put_str(cv, 1, 12, "█████████████████████████████"); 67 66 68 c ucul_set_color_ansi(cv, CUCUL_LIGHTGREEN, CUCUL_LIGHTRED);69 c ucul_put_str(cv, 36, 8, "█████████████████████████████");70 c ucul_put_str(cv, 36, 9, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓");71 c ucul_put_str(cv, 36, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒");72 c ucul_put_str(cv, 36, 11, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░");73 c ucul_put_str(cv, 36, 12, " ");67 caca_set_color_ansi(cv, CACA_LIGHTGREEN, CACA_LIGHTRED); 68 caca_put_str(cv, 36, 8, "█████████████████████████████"); 69 caca_put_str(cv, 36, 9, "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"); 70 caca_put_str(cv, 36, 10, "▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"); 71 caca_put_str(cv, 36, 11, "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"); 72 caca_put_str(cv, 36, 12, " "); 74 73 75 c ucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLUE);76 c ucul_put_str(cv, 1, 14, "Double width characters");74 caca_set_color_ansi(cv, CACA_WHITE, CACA_BLUE); 75 caca_put_str(cv, 1, 14, "Double width characters"); 77 76 78 c ucul_set_color_ansi(cv, CUCUL_LIGHTRED, CUCUL_TRANSPARENT);79 c ucul_put_str(cv, 1, 15, "| ドラゴン ボーレ |");80 c ucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT);81 c ucul_put_str(cv, 1, 16, "| ()()()() ()()() |");82 c ucul_set_color_ansi(cv, CUCUL_YELLOW, CUCUL_TRANSPARENT);83 c ucul_put_str(cv, 1, 17, "| ドラゴン");84 c ucul_put_str(cv, 12, 17, "ボーレ |");77 caca_set_color_ansi(cv, CACA_LIGHTRED, CACA_TRANSPARENT); 78 caca_put_str(cv, 1, 15, "| ドラゴン ボーレ |"); 79 caca_set_color_ansi(cv, CACA_DEFAULT, CACA_TRANSPARENT); 80 caca_put_str(cv, 1, 16, "| ()()()() ()()() |"); 81 caca_set_color_ansi(cv, CACA_YELLOW, CACA_TRANSPARENT); 82 caca_put_str(cv, 1, 17, "| ドラゴン"); 83 caca_put_str(cv, 12, 17, "ボーレ |"); 85 84 86 c ucul_set_color_ansi(cv, CUCUL_DEFAULT, CUCUL_TRANSPARENT);87 c ucul_put_str(cv, 1, 18, "If the three lines do not have the same length, there is a bug somewhere.");85 caca_set_color_ansi(cv, CACA_DEFAULT, CACA_TRANSPARENT); 86 caca_put_str(cv, 1, 18, "If the three lines do not have the same length, there is a bug somewhere."); 88 87 89 c ucul_put_str(cv, 1, 20, "CP437 glyphs: ☺ ☻ ♥ ♦ ♣ ♠ • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼ ► ◄ ↕ ‼ ¶ § ▬ ↨ ↑ ↓ → ← ∟ ↔ ▲ ▼");90 c ucul_put_str(cv, 1, 21, "more CP437: α ß Γ π Σ σ µ τ Φ Θ Ω δ ∞ φ ε ∩ ≡ ± ≥ ≤ ⌠ ⌡ ÷ ≈ ° ∙ · √ ⁿ ² ■");91 c ucul_put_str(cv, 1, 22, "drawing blocks: ███ ▓▓▓ ▒▒▒ ░░░ ▀ ▄ ▌ ▐ █ ▖ ▗ ▘ ▝ ▚ ▞ ▙ ▛ ▜ ▟ ─ │ ┌ ┐ └ ┘ ├ ┤");92 c ucul_put_str(cv, 1, 23, "more drawing: ┬ ┴ ┼ ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟ ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬");93 c ucul_put_str(cv, 1, 24, "misc Unicode: ● ☭ ☮ ☯ ♔ ♛ ♙ ♞ ⚒ ⚓ ⚠");88 caca_put_str(cv, 1, 20, "CP437 glyphs: ☺ ☻ ♥ ♦ ♣ ♠ • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼ ► ◄ ↕ ‼ ¶ § ▬ ↨ ↑ ↓ → ← ∟ ↔ ▲ ▼"); 89 caca_put_str(cv, 1, 21, "more CP437: α ß Γ π Σ σ µ τ Φ Θ Ω δ ∞ φ ε ∩ ≡ ± ≥ ≤ ⌠ ⌡ ÷ ≈ ° ∙ · √ ⁿ ² ■"); 90 caca_put_str(cv, 1, 22, "drawing blocks: ███ ▓▓▓ ▒▒▒ ░░░ ▀ ▄ ▌ ▐ █ ▖ ▗ ▘ ▝ ▚ ▞ ▙ ▛ ▜ ▟ ─ │ ┌ ┐ └ ┘ ├ ┤"); 91 caca_put_str(cv, 1, 23, "more drawing: ┬ ┴ ┼ ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟ ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬"); 92 caca_put_str(cv, 1, 24, "misc Unicode: ● ☭ ☮ ☯ ♔ ♛ ♙ ♞ ⚒ ⚓ ⚠"); 94 93 95 94 caca_refresh_display(dp); … … 98 97 99 98 caca_free_display(dp); 100 c ucul_free_canvas(cv);99 caca_free_canvas(cv); 101 100 102 101 return 0;
Note: See TracChangeset
for help on using the changeset viewer.