Browse Source

* Added test/truecolor.c to test non-ANSI colour pairs.

tags/v0.99.beta14
Sam Hocevar sam 19 years ago
parent
commit
960aceabac
2 changed files with 61 additions and 1 deletions
  1. +4
    -1
      test/Makefile.am
  2. +57
    -0
      test/truecolor.c

+ 4
- 1
test/Makefile.am View File

@@ -2,7 +2,7 @@

AM_CPPFLAGS = -I$(top_srcdir)/cucul -I$(top_srcdir)/caca -DDATADIR=\"$(pkgdatadir)\"

noinst_PROGRAMS = colors demo dithering event export font gamma hsv spritedit transform unicode
noinst_PROGRAMS = colors demo dithering event export font gamma hsv spritedit transform truecolor unicode

colors_SOURCES = colors.c
colors_LDADD = ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@
@@ -34,6 +34,9 @@ spritedit_LDADD = ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@
transform_SOURCES = transform.c
transform_LDADD = ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@

truecolor_SOURCES = truecolor.c
truecolor_LDADD = ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@

unicode_SOURCES = unicode.c
unicode_LDADD = ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@


+ 57
- 0
test/truecolor.c View File

@@ -0,0 +1,57 @@
/*
* truecolor truecolor canvas features
* Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
* All Rights Reserved
*
* $Id$
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the Do What The Fuck You Want To
* Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/

#include "config.h"

#if defined(HAVE_INTTYPES_H)
# include <inttypes.h>
#else
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#endif

#include "cucul.h"
#include "caca.h"

int main(void)
{
caca_event_t ev;
cucul_t *qq;
caca_t *kk;

int x, y;

qq = cucul_create(32, 16);
kk = caca_attach(qq);

for(y = 0; y < 16; y++)
for(x = 0; x < 16; x++)
{
uint16_t bgcolor = 0xff00 | (y << 4) | x;
uint16_t fgcolor = 0xf000 | ((15 - y) << 4) | ((15 - x) << 8);

cucul_set_truecolor(qq, fgcolor, bgcolor);
cucul_putstr(qq, x * 2, y, "CA");
}

caca_display(kk);

caca_get_event(kk, CACA_EVENT_KEY_PRESS, &ev, -1);

caca_detach(kk);
cucul_free(qq);

return 0;
}


Loading…
Cancel
Save