source: libcaca/trunk/test/fullwidth.c @ 1347

Last change on this file since 1347 was 1347, checked in by Sam Hocevar, 14 years ago
  • Rename cucul_put*() into cucul_put_*(). Updated all code to reflect that.
  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
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 1347 2006-11-11 16:29:39Z sam $
7 *
8 *  This program is free software; you can redistribute it and/or
9 *  modify it under the terms of the Do What The Fuck You Want To
10 *  Public License, Version 2, as published by Sam Hocevar. See
11 *  http://sam.zoy.org/wtfpl/COPYING for more details.
12 */
13
14#include "config.h"
15#include "common.h"
16
17#if !defined(__KERNEL__)
18#   if defined(HAVE_INTTYPES_H)
19#      include <inttypes.h>
20#   endif
21#   include <stdio.h>
22#endif
23
24#include "cucul.h"
25#include "caca.h"
26
27#define CACA "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊"
28
29int main(int argc, char *argv[])
30{
31    cucul_canvas_t *cv, *caca, *line;
32    caca_display_t *dp;
33
34    unsigned int i;
35
36    cv = cucul_create_canvas(0, 0);
37    dp = caca_create_display(cv);
38
39    caca = cucul_create_canvas(6, 10);
40    line = cucul_create_canvas(2, 1);
41
42    /* Line of x's */
43    for(i = 0; i < 10; i++)
44    {
45        cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE);
46        cucul_put_str(caca, 0, i, CACA);
47        cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_RED);
48        cucul_put_char(caca, i - 2, i, 'x');
49    }
50
51    cucul_blit(cv, 1, 1, caca, NULL);
52
53    /* Line of ホ'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_GREEN);
59        cucul_put_str(caca, i - 2, i, "ホ");
60    }
61
62    cucul_blit(cv, 15, 1, caca, NULL);
63
64    /* Line of canvas */
65    cucul_set_color_ansi(line, CUCUL_WHITE, CUCUL_MAGENTA);
66    cucul_put_str(line, 0, 0, "ほ");
67    for(i = 0; i < 10; i++)
68    {
69        cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE);
70        cucul_put_str(caca, 0, i, CACA);
71        cucul_blit(caca, i - 2, i, line, NULL);
72    }
73
74    cucul_blit(cv, 29, 1, caca, NULL);
75
76    caca_refresh_display(dp);
77
78    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
79
80    caca_free_display(dp);
81
82    cucul_free_canvas(line);
83    cucul_free_canvas(caca);
84    cucul_free_canvas(cv);
85
86    return 0;
87}
88
Note: See TracBrowser for help on using the repository browser.