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

Last change on this file since 4333 was 4333, checked in by Sam Hocevar, 12 years ago

Large source code cleanup, getting rid of spaces, tabs, and svn keywords.

  • 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 *  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
13#include "config.h"
14
15#if !defined(__KERNEL__)
16#   include <stdio.h>
17#endif
18
19#include "caca.h"
20
21#define CACA "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊"
22
23int main(int argc, char *argv[])
24{
25    caca_canvas_t *cv, *caca, *line;
26    caca_display_t *dp;
27
28    unsigned int i;
29
30    cv = caca_create_canvas(0, 0);
31    if(cv == NULL)
32    {
33        printf("Can't created canvas\n");
34        return -1;
35    }
36    dp = caca_create_display(cv);
37    if(dp == NULL)
38    {
39        printf("Can't create display\n");
40        return -1;
41    }
42
43    caca = caca_create_canvas(6, 10);
44    line = caca_create_canvas(2, 1);
45
46    /* Line of x's */
47    for(i = 0; i < 10; i++)
48    {
49        caca_set_color_ansi(caca, CACA_WHITE, CACA_BLUE);
50        caca_put_str(caca, 0, i, CACA);
51        caca_set_color_ansi(caca, CACA_WHITE, CACA_RED);
52        caca_put_char(caca, i - 2, i, 'x');
53    }
54
55    caca_blit(cv, 1, 1, caca, NULL);
56
57    /* Line of ホ's */
58    for(i = 0; i < 10; i++)
59    {
60        caca_set_color_ansi(caca, CACA_WHITE, CACA_BLUE);
61        caca_put_str(caca, 0, i, CACA);
62        caca_set_color_ansi(caca, CACA_WHITE, CACA_GREEN);
63        caca_put_str(caca, i - 2, i, "ホ");
64    }
65
66    caca_blit(cv, 15, 1, caca, NULL);
67
68    /* Line of canvas */
69    caca_set_color_ansi(line, CACA_WHITE, CACA_MAGENTA);
70    caca_put_str(line, 0, 0, "ほ");
71    for(i = 0; i < 10; i++)
72    {
73        caca_set_color_ansi(caca, CACA_WHITE, CACA_BLUE);
74        caca_put_str(caca, 0, i, CACA);
75        caca_blit(caca, i - 2, i, line, NULL);
76    }
77
78    caca_blit(cv, 29, 1, caca, NULL);
79
80    caca_refresh_display(dp);
81
82    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
83
84    caca_free_display(dp);
85
86    caca_free_canvas(line);
87    caca_free_canvas(caca);
88    caca_free_canvas(cv);
89
90    return 0;
91}
92
Note: See TracBrowser for help on using the repository browser.