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

Last change on this file since 1217 was 1217, checked in by Sam Hocevar, 15 years ago
  • Use 0xCACA as the test character. Ahaha. Caca. Got it?
  • Property svn:keywords set to Id
File size: 1.6 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 1217 2006-10-22 16:16:15Z 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;
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
41    for(i = 0; i < 10; i++)
42    {
43        cucul_set_color(caca, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE);
44        cucul_putstr(caca, 0, i, CACA);
45        cucul_set_color(caca, CUCUL_COLOR_WHITE, CUCUL_COLOR_RED);
46        cucul_putchar(caca, i - 2, i, 'x');
47    }
48
49    cucul_blit(cv, 1, 1, caca, NULL);
50
51    for(i = 0; i < 10; i++)
52    {
53        cucul_set_color(caca, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE);
54        cucul_putstr(caca, 0, i, CACA);
55        cucul_set_color(caca, CUCUL_COLOR_WHITE, CUCUL_COLOR_GREEN);
56        cucul_putstr(caca, i - 2, i, "ホ");
57    }
58
59    cucul_blit(cv, 15, 1, caca, NULL);
60
61    caca_refresh_display(dp);
62
63    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
64
65    caca_free_display(dp);
66    cucul_free_canvas(cv);
67
68    return 0;
69}
70
Note: See TracBrowser for help on using the repository browser.