1 | /* |
---|
2 | * fullwidth libcaca fullwidth Unicode characters test program |
---|
3 | * Copyright (c) 2006 Sam Hocevar <sam@zoy.org> |
---|
4 | * All Rights Reserved |
---|
5 | * |
---|
6 | * $Id: fullwidth.c 2101 2007-11-30 23:48:39Z sam $ |
---|
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 | |
---|
15 | #include "config.h" |
---|
16 | #include "common.h" |
---|
17 | |
---|
18 | #if !defined(__KERNEL__) |
---|
19 | # if defined(HAVE_INTTYPES_H) |
---|
20 | # include <inttypes.h> |
---|
21 | # endif |
---|
22 | # include <stdio.h> |
---|
23 | #endif |
---|
24 | |
---|
25 | #include "cucul.h" |
---|
26 | #include "caca.h" |
---|
27 | |
---|
28 | #define CACA "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊" |
---|
29 | |
---|
30 | int main(int argc, char *argv[]) |
---|
31 | { |
---|
32 | cucul_canvas_t *cv, *caca, *line; |
---|
33 | caca_display_t *dp; |
---|
34 | |
---|
35 | unsigned int i; |
---|
36 | |
---|
37 | cv = cucul_create_canvas(0, 0); |
---|
38 | if(cv == NULL) |
---|
39 | { |
---|
40 | printf("Can't created canvas\n"); |
---|
41 | return -1; |
---|
42 | } |
---|
43 | dp = caca_create_display(cv); |
---|
44 | if(dp == NULL) |
---|
45 | { |
---|
46 | printf("Can't create display\n"); |
---|
47 | return -1; |
---|
48 | } |
---|
49 | |
---|
50 | caca = cucul_create_canvas(6, 10); |
---|
51 | line = cucul_create_canvas(2, 1); |
---|
52 | |
---|
53 | /* Line of x's */ |
---|
54 | for(i = 0; i < 10; i++) |
---|
55 | { |
---|
56 | cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE); |
---|
57 | cucul_put_str(caca, 0, i, CACA); |
---|
58 | cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_RED); |
---|
59 | cucul_put_char(caca, i - 2, i, 'x'); |
---|
60 | } |
---|
61 | |
---|
62 | cucul_blit(cv, 1, 1, caca, NULL); |
---|
63 | |
---|
64 | /* Line of ホ's */ |
---|
65 | for(i = 0; i < 10; i++) |
---|
66 | { |
---|
67 | cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE); |
---|
68 | cucul_put_str(caca, 0, i, CACA); |
---|
69 | cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_GREEN); |
---|
70 | cucul_put_str(caca, i - 2, i, "ホ"); |
---|
71 | } |
---|
72 | |
---|
73 | cucul_blit(cv, 15, 1, caca, NULL); |
---|
74 | |
---|
75 | /* Line of canvas */ |
---|
76 | cucul_set_color_ansi(line, CUCUL_WHITE, CUCUL_MAGENTA); |
---|
77 | cucul_put_str(line, 0, 0, "ほ"); |
---|
78 | for(i = 0; i < 10; i++) |
---|
79 | { |
---|
80 | cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE); |
---|
81 | cucul_put_str(caca, 0, i, CACA); |
---|
82 | cucul_blit(caca, i - 2, i, line, NULL); |
---|
83 | } |
---|
84 | |
---|
85 | cucul_blit(cv, 29, 1, caca, NULL); |
---|
86 | |
---|
87 | caca_refresh_display(dp); |
---|
88 | |
---|
89 | caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1); |
---|
90 | |
---|
91 | caca_free_display(dp); |
---|
92 | |
---|
93 | cucul_free_canvas(line); |
---|
94 | cucul_free_canvas(caca); |
---|
95 | cucul_free_canvas(cv); |
---|
96 | |
---|
97 | return 0; |
---|
98 | } |
---|
99 | |
---|