Browse Source

* test/colors.c:

+ Extracted the colour test from examples/demo.c.
tags/v0.99.beta14
Sam Hocevar sam 21 years ago
parent
commit
40a1d07570
2 changed files with 61 additions and 1 deletions
  1. +5
    -1
      test/Makefile.am
  2. +56
    -0
      test/colors.c

+ 5
- 1
test/Makefile.am View File

@@ -1,6 +1,10 @@
# $Id$

noinst_PROGRAMS = dithering event hsv optipal spritedit
noinst_PROGRAMS = colors dithering event hsv optipal spritedit

colors_SOURCES = colors.c
colors_LDADD = ../src/libcaca.a @CACA_LIBS@
colors_CPPFLAGS = -I$(top_srcdir)/src

dithering_SOURCES = dithering.c
dithering_LDADD = ../src/libcaca.a @CACA_LIBS@


+ 56
- 0
test/colors.c View File

@@ -0,0 +1,56 @@
/*
* colors display all possible libcaca colour pairs
* Copyright (c) 2003-2004 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 GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*/

#include "config.h"

#include <stdio.h>

#include "caca.h"

int main(int argc, char **argv)
{
int i, j;

if(caca_init())
return 1;

caca_clear();
for(i = 0; i < 16; i++)
{
caca_set_color(CACA_COLOR_LIGHTGRAY, CACA_COLOR_BLACK);
caca_printf(4, i + (i >= 8 ? 4 : 3), "'%c': %i (%s)",
'a' + i, i, caca_get_color_name(i));
for(j = 0; j < 16; j++)
{
caca_set_color(i, j);
caca_putstr((j >= 8 ? 41 : 40) + j * 2, i + (i >= 8 ? 4 : 3), "# ");
}
}

caca_refresh();
caca_wait_event(CACA_EVENT_KEY_PRESS);
caca_end();

return 0;
}


Loading…
Cancel
Save