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

Last change on this file since 777 was 777, checked in by Sam Hocevar, 15 years ago
  • Replaced "struct cucul_*" and "struct caca_*" types with opaque typedefs such as cucul_dither_t instead of struct cucul_dither.
  • Made cucul_buffer_t an opaque structure and implemented the two getters cucul_get_buffer_data() and cucul_get_buffer_size().
  • Documented all missing functions and function parameters.
  • Property svn:keywords set to Id
File size: 1.3 KB
RevLine 
[85]1/*
[350]2 *  colors        display all possible libcaca colour pairs
3 *  Copyright (c) 2003-2004 Sam Hocevar <sam@zoy.org>
[268]4 *                All Rights Reserved
[85]5 *
[268]6 *  $Id: colors.c 777 2006-04-16 18:28:47Z sam $
[85]7 *
[268]8 *  This program is free software; you can redistribute it and/or
[522]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.
[85]12 */
13
[105]14#include "config.h"
15
[592]16#if !defined(__KERNEL__)
17#   include <stdio.h>
18#endif
[99]19
[524]20#include "cucul.h"
[185]21#include "caca.h"
[85]22
23int main(int argc, char **argv)
24{
[524]25    cucul_t *qq;
26    caca_t *kk;
[777]27    caca_event_t ev;
[350]28    int i, j;
[85]29
[677]30    qq = cucul_create(0, 0);
[524]31    if(!qq)
[85]32        return 1;
33
[524]34    kk = caca_attach(qq);
35    if(!kk)
36        return 1;
37
38    cucul_clear(qq);
[159]39    for(i = 0; i < 16; i++)
40    {
[524]41        cucul_set_color(qq, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
42        cucul_printf(qq, 4, i + (i >= 8 ? 4 : 3), "'%c': %i (%s)",
43                     'a' + i, i, cucul_get_color_name(i));
[226]44        for(j = 0; j < 16; j++)
45        {
[524]46            cucul_set_color(qq, i, j);
47            cucul_putstr(qq, (j >= 8 ? 41 : 40) + j * 2, i + (i >= 8 ? 4 : 3),
48                         "# ");
[226]49        }
[159]50    }
51
[527]52    caca_display(kk);
[710]53    caca_get_event(kk, CACA_EVENT_KEY_PRESS, &ev, -1);
[103]54
[524]55    caca_detach(kk);
[677]56    cucul_free(qq);
[524]57
[350]58    return 0;
[103]59}
60
Note: See TracBrowser for help on using the repository browser.