[1216] | 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 2821 2008-09-27 13:12:46Z sam $ |
---|
| 7 | * |
---|
[1462] | 8 | * This program is free software. It comes without any warranty, to |
---|
[1452] | 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 |
---|
[1216] | 12 | * http://sam.zoy.org/wtfpl/COPYING for more details. |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | #include "config.h" |
---|
| 16 | |
---|
| 17 | #if !defined(__KERNEL__) |
---|
| 18 | # include <stdio.h> |
---|
| 19 | #endif |
---|
| 20 | |
---|
| 21 | #include "caca.h" |
---|
| 22 | |
---|
[1217] | 23 | #define CACA "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊" |
---|
[1216] | 24 | |
---|
| 25 | int main(int argc, char *argv[]) |
---|
| 26 | { |
---|
[2821] | 27 | caca_canvas_t *cv, *caca, *line; |
---|
[1216] | 28 | caca_display_t *dp; |
---|
| 29 | |
---|
| 30 | unsigned int i; |
---|
| 31 | |
---|
[2821] | 32 | cv = caca_create_canvas(0, 0); |
---|
[1753] | 33 | if(cv == NULL) |
---|
| 34 | { |
---|
| 35 | printf("Can't created canvas\n"); |
---|
| 36 | return -1; |
---|
| 37 | } |
---|
[1216] | 38 | dp = caca_create_display(cv); |
---|
[1753] | 39 | if(dp == NULL) |
---|
| 40 | { |
---|
| 41 | printf("Can't create display\n"); |
---|
| 42 | return -1; |
---|
| 43 | } |
---|
[1216] | 44 | |
---|
[2821] | 45 | caca = caca_create_canvas(6, 10); |
---|
| 46 | line = caca_create_canvas(2, 1); |
---|
[1216] | 47 | |
---|
[1224] | 48 | /* Line of x's */ |
---|
[1216] | 49 | for(i = 0; i < 10; i++) |
---|
| 50 | { |
---|
[2821] | 51 | caca_set_color_ansi(caca, CACA_WHITE, CACA_BLUE); |
---|
| 52 | caca_put_str(caca, 0, i, CACA); |
---|
| 53 | caca_set_color_ansi(caca, CACA_WHITE, CACA_RED); |
---|
| 54 | caca_put_char(caca, i - 2, i, 'x'); |
---|
[1216] | 55 | } |
---|
| 56 | |
---|
[2821] | 57 | caca_blit(cv, 1, 1, caca, NULL); |
---|
[1216] | 58 | |
---|
[1224] | 59 | /* Line of ホ's */ |
---|
[1216] | 60 | for(i = 0; i < 10; i++) |
---|
| 61 | { |
---|
[2821] | 62 | caca_set_color_ansi(caca, CACA_WHITE, CACA_BLUE); |
---|
| 63 | caca_put_str(caca, 0, i, CACA); |
---|
| 64 | caca_set_color_ansi(caca, CACA_WHITE, CACA_GREEN); |
---|
| 65 | caca_put_str(caca, i - 2, i, "ホ"); |
---|
[1216] | 66 | } |
---|
| 67 | |
---|
[2821] | 68 | caca_blit(cv, 15, 1, caca, NULL); |
---|
[1216] | 69 | |
---|
[1224] | 70 | /* Line of canvas */ |
---|
[2821] | 71 | caca_set_color_ansi(line, CACA_WHITE, CACA_MAGENTA); |
---|
| 72 | caca_put_str(line, 0, 0, "ほ"); |
---|
[1224] | 73 | for(i = 0; i < 10; i++) |
---|
| 74 | { |
---|
[2821] | 75 | caca_set_color_ansi(caca, CACA_WHITE, CACA_BLUE); |
---|
| 76 | caca_put_str(caca, 0, i, CACA); |
---|
| 77 | caca_blit(caca, i - 2, i, line, NULL); |
---|
[1224] | 78 | } |
---|
| 79 | |
---|
[2821] | 80 | caca_blit(cv, 29, 1, caca, NULL); |
---|
[1224] | 81 | |
---|
[1216] | 82 | caca_refresh_display(dp); |
---|
| 83 | |
---|
| 84 | caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1); |
---|
| 85 | |
---|
| 86 | caca_free_display(dp); |
---|
[1224] | 87 | |
---|
[2821] | 88 | caca_free_canvas(line); |
---|
| 89 | caca_free_canvas(caca); |
---|
| 90 | caca_free_canvas(cv); |
---|
[1216] | 91 | |
---|
| 92 | return 0; |
---|
| 93 | } |
---|
| 94 | |
---|