Last change
on this file since 811 was
811,
checked in by Sam Hocevar, 15 years ago
|
- Renamed caca_t into caca_display_t.
- Renamed canvas handle variables from "c" to "cv". Eh ouais mon gros.
|
-
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 811 2006-04-18 15:11:25Z 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 | #if !defined(__KERNEL__) |
---|
17 | # include <stdio.h> |
---|
18 | #endif |
---|
19 | |
---|
20 | #include "cucul.h" |
---|
21 | #include "caca.h" |
---|
22 | |
---|
23 | int main(int argc, char **argv) |
---|
24 | { |
---|
25 | cucul_canvas_t *cv; |
---|
26 | caca_display_t *dp; |
---|
27 | caca_event_t ev; |
---|
28 | int i, j; |
---|
29 | |
---|
30 | cv = cucul_create(0, 0); |
---|
31 | if(!cv) |
---|
32 | return 1; |
---|
33 | |
---|
34 | dp = caca_attach(cv); |
---|
35 | if(!dp) |
---|
36 | return 1; |
---|
37 | |
---|
38 | cucul_clear(cv); |
---|
39 | for(i = 0; i < 16; i++) |
---|
40 | { |
---|
41 | cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK); |
---|
42 | cucul_printf(cv, 4, i + (i >= 8 ? 4 : 3), "'%cv': %i (%s)", |
---|
43 | 'a' + i, i, cucul_get_color_name(i)); |
---|
44 | for(j = 0; j < 16; j++) |
---|
45 | { |
---|
46 | cucul_set_color(cv, i, j); |
---|
47 | cucul_putstr(cv, (j >= 8 ? 41 : 40) + j * 2, i + (i >= 8 ? 4 : 3), |
---|
48 | "# "); |
---|
49 | } |
---|
50 | } |
---|
51 | |
---|
52 | caca_display(dp); |
---|
53 | caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1); |
---|
54 | |
---|
55 | caca_detach(dp); |
---|
56 | cucul_free(cv); |
---|
57 | |
---|
58 | return 0; |
---|
59 | } |
---|
60 | |
---|
Note: See
TracBrowser
for help on using the repository browser.