source: libcaca/trunk/test/truecolor.c @ 1256

Last change on this file since 1256 was 1256, checked in by Sam Hocevar, 14 years ago
  • Remove cucul_set_color() from the exported API and replaced all calls with cucul_set_attr_ansi(). Old application will still compile (but issue a warning) and run, though.
  • Property svn:keywords set to Id
File size: 1.3 KB
Line 
1/*
2 *  truecolor     truecolor canvas features
3 *  Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
4 *                All Rights Reserved
5 *
6 *  $Id: truecolor.c 1256 2006-10-29 08:35:46Z 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
27int main(int argc, char *argv[])
28{
29    cucul_canvas_t *cv;
30    caca_display_t *dp;
31
32    int x, y;
33
34    cv = cucul_create_canvas(32, 16);
35    dp = caca_create_display(cv);
36
37    for(y = 0; y < 16; y++)
38        for(x = 0; x < 16; x++)
39    {
40        uint16_t bgcolor = 0xff00 | (y << 4) | x;
41        uint16_t fgcolor = 0xf000 | ((15 - y) << 4) | ((15 - x) << 8);
42
43        cucul_set_attr_argb(cv, fgcolor, bgcolor, 0);
44        cucul_putstr(cv, x * 2, y, "CA");
45    }
46
47    cucul_set_attr_ansi(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_LIGHTBLUE, 0);
48    cucul_putstr(cv, 2, 1, " truecolor libcaca ");
49
50    caca_refresh_display(dp);
51
52    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
53
54    caca_free_display(dp);
55    cucul_free_canvas(cv);
56
57    return 0;
58}
59
Note: See TracBrowser for help on using the repository browser.