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

Last change on this file since 1452 was 1452, checked in by Sam Hocevar, 13 years ago
  • Add a no warranty clause to the code.
  • 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@zoy.org>
4 *                All Rights Reserved
5 *
6 *  $Id: fullwidth.c 1452 2006-12-11 15:48:46Z sam $
7 *
8 *  This program is free software. It commes 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
30int 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    dp = caca_create_display(cv);
39
40    caca = cucul_create_canvas(6, 10);
41    line = cucul_create_canvas(2, 1);
42
43    /* Line of x's */
44    for(i = 0; i < 10; i++)
45    {
46        cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE);
47        cucul_put_str(caca, 0, i, CACA);
48        cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_RED);
49        cucul_put_char(caca, i - 2, i, 'x');
50    }
51
52    cucul_blit(cv, 1, 1, caca, NULL);
53
54    /* Line of ホ's */
55    for(i = 0; i < 10; i++)
56    {
57        cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE);
58        cucul_put_str(caca, 0, i, CACA);
59        cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_GREEN);
60        cucul_put_str(caca, i - 2, i, "ホ");
61    }
62
63    cucul_blit(cv, 15, 1, caca, NULL);
64
65    /* Line of canvas */
66    cucul_set_color_ansi(line, CUCUL_WHITE, CUCUL_MAGENTA);
67    cucul_put_str(line, 0, 0, "ほ");
68    for(i = 0; i < 10; i++)
69    {
70        cucul_set_color_ansi(caca, CUCUL_WHITE, CUCUL_BLUE);
71        cucul_put_str(caca, 0, i, CACA);
72        cucul_blit(caca, i - 2, i, line, NULL);
73    }
74
75    cucul_blit(cv, 29, 1, caca, NULL);
76
77    caca_refresh_display(dp);
78
79    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
80
81    caca_free_display(dp);
82
83    cucul_free_canvas(line);
84    cucul_free_canvas(caca);
85    cucul_free_canvas(cv);
86
87    return 0;
88}
89
Note: See TracBrowser for help on using the repository browser.