diff --git a/test/Makefile.am b/test/Makefile.am index 6e9ace4..67afd77 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -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@ diff --git a/test/truecolor.c b/test/truecolor.c new file mode 100644 index 0000000..9f10b13 --- /dev/null +++ b/test/truecolor.c @@ -0,0 +1,57 @@ +/* + * truecolor truecolor canvas features + * Copyright (c) 2006 Sam Hocevar + * 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 +#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; +} +