source: libcaca/trunk/examples/fullwidth.c @ 4148

Last change on this file since 4148 was 4148, checked in by Sam Hocevar, 10 years ago

Update my e-mail address everywhere.

  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1/*
2 *  fullwidth     libcaca fullwidth Unicode characters test program
3 *  Copyright (c) 2006 Sam Hocevar <sam@hocevar.net>
4 *                All Rights Reserved
5 *
6 *  $Id: fullwidth.c 4148 2009-12-19 14:38:38Z 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
17#if !defined(__KERNEL__)
18#   include <stdio.h>
19#endif
20
21#include "caca.h"
22
23#define CACA "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊"
24
25int main(int argc, char *argv[])
26{
27    caca_canvas_t *cv, *caca, *line;
28    caca_display_t *dp;
29
30    unsigned int i;
31
32    cv = caca_create_canvas(0, 0);
33    if(cv == NULL)
34    {
35        printf("Can't created canvas\n");
36        return -1;
37    }
38    dp = caca_create_display(cv);
39    if(dp == NULL)
40    {
41        printf("Can't create display\n");
42        return -1;
43    }
44
45    caca = caca_create_canvas(6, 10);
46    line = caca_create_canvas(2, 1);
47
48    /* Line of x's */
49    for(i = 0; i < 10; i++)
50    {
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');
55    }
56
57    caca_blit(cv, 1, 1, caca, NULL);
58
59    /* Line of ホ's */
60    for(i = 0; i < 10; i++)
61    {
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, "ホ");
66    }
67
68    caca_blit(cv, 15, 1, caca, NULL);
69
70    /* Line of canvas */
71    caca_set_color_ansi(line, CACA_WHITE, CACA_MAGENTA);
72    caca_put_str(line, 0, 0, "ほ");
73    for(i = 0; i < 10; i++)
74    {
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);
78    }
79
80    caca_blit(cv, 29, 1, caca, NULL);
81
82    caca_refresh_display(dp);
83
84    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
85
86    caca_free_display(dp);
87
88    caca_free_canvas(line);
89    caca_free_canvas(caca);
90    caca_free_canvas(cv);
91
92    return 0;
93}
94
Note: See TracBrowser for help on using the repository browser.