source: libcaca/trunk/test/colors.c @ 527

Last change on this file since 527 was 527, checked in by Sam Hocevar, 15 years ago
  • All output plugins should now work again.
  • Renamed caca_refresh() into caca_display() which makes more sense.
  • Optimised gl_bgpal by directly storing floats instead of doing the conversion at runtime.
  • Handle resizing in cucul_set_size() and try to keep as much information as possible from the previous canvas.
  • Moved most global variables into cucul_t or caca_t contexts.
  • Moved time.c into libcaca.
  • Property svn:keywords set to Id
File size: 1.3 KB
Line 
1/*
2 *  colors        display all possible libcaca colour pairs
3 *  Copyright (c) 2003-2004 Sam Hocevar <sam@zoy.org>
4 *                All Rights Reserved
5 *
6 *  $Id: colors.c 527 2006-03-06 08:32:40Z 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
16#include <stdio.h>
17
18#include "cucul.h"
19#include "caca.h"
20
21int main(int argc, char **argv)
22{
23    cucul_t *qq;
24    caca_t *kk;
25    int i, j;
26
27    qq = cucul_init();
28    if(!qq)
29        return 1;
30
31    kk = caca_attach(qq);
32    if(!kk)
33        return 1;
34
35    cucul_clear(qq);
36    for(i = 0; i < 16; i++)
37    {
38        cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
39        cucul_printf(qq, 4, i + (i >= 8 ? 4 : 3), "'%c': %i (%s)",
40                     'a' + i, i, cucul_get_color_name(i));
41        for(j = 0; j < 16; j++)
42        {
43            cucul_set_color(qq, i, j);
44            cucul_putstr(qq, (j >= 8 ? 41 : 40) + j * 2, i + (i >= 8 ? 4 : 3),
45                         "# ");
46        }
47    }
48
49    caca_display(kk);
50    caca_wait_event(kk, CACA_EVENT_KEY_PRESS);
51
52    caca_detach(kk);
53    cucul_end(qq);
54
55    return 0;
56}
57
Note: See TracBrowser for help on using the repository browser.