source: ttyvaders/trunk/libee/ee.h @ 122

Last change on this file since 122 was 122, checked in by Sam Hocevar, 17 years ago
  • libee/sprite.c: + More robust sprite loader. + Added ee_set_sprite_frame() and ee_get_sprite_frame(). + Free all structures in ee_free_sprite().
  • src/aliens.c src/bonus.c: + Use ee_draw_sprite() instead of our manual sprite rendering.
  • src/box.c: + Use ee_draw_line() instead of the manual equivalent.
  • data/: + Added foo_fighter, baz_fighter, item_gem and item_heart sprites.
  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1/*
2 *   libee         ASCII-Art library
3 *   Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org>
4 *                 All Rights Reserved
5 *
6 *   $Id: ee.h 122 2003-11-10 09:26:40Z sam $
7 *
8 *   This program is free software; you can redistribute it and/or modify
9 *   it under the terms of the GNU General Public License as published by
10 *   the Free Software Foundation; either version 2 of the License, or
11 *   (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23/*
24 * Graphics primitives
25 */
26#ifdef USE_SLANG
27#   include <slang.h>
28#   define ee_color(x) SLsmg_set_color(x)
29#   define ee_goto(x,y) SLsmg_gotorc(y,x)
30#   define ee_putchar(x) SLsmg_write_char(x)
31#   define ee_putstr(x) SLsmg_write_string(x)
32#elif USE_NCURSES
33#   define box box_divert
34#   include <curses.h>
35#   undef box
36#   define ee_color(x) attrset(COLOR_PAIR(x))
37#   define ee_goto(x,y) move(y,x)
38#   define ee_putchar(x) addch(x)
39#   define ee_putstr(x) addstr(x)
40#else
41#   define ee_color(x) (void)(x)
42#   define ee_goto(x,y) do{ (void)(x); (void)(y); } while(0)
43#   define ee_putchar(x) (void)(x)
44#   define ee_putstr(x) (void)(x)
45#endif
46
47#define ee_putcharTO(x,y,c) do{ ee_goto(x,y); ee_putchar(c); }while(0)
48
49/*
50 * Colours
51 */
52#define EE_BLACK 1
53#define EE_GREEN 2
54#define EE_YELLOW 3
55#define EE_WHITE 4
56#define EE_RED 5
57#define EE_GRAY 6
58#define EE_LIGHTGRAY 7
59#define EE_BLUE 8
60#define EE_CYAN 9
61#define EE_MAGENTA 10
62
63/*
64 * Types
65 */
66struct ee_sprite;
67
68/*
69 * Prototypes
70 */
71int ee_init(void);
72void ee_set_delay(int);
73int ee_get_width(void);
74int ee_get_height(void);
75void ee_clear(void);
76void ee_refresh(void);
77void ee_end(void);
78
79char ee_get_key(void);
80
81void ee_draw_line(int, int, int, int, char);
82void ee_draw_thin_line(int, int, int, int);
83void ee_draw_circle(int, int, int, char);
84void ee_fill_triangle(int, int, int, int, int, int, char);
85
86int ee_rand(int, int);
87int ee_sqrt(int);
88
89struct ee_sprite * ee_load_sprite(const char *);
90void ee_set_sprite_frame(struct ee_sprite *, int);
91int ee_get_sprite_frame(struct ee_sprite *);
92void ee_draw_sprite(int, int, struct ee_sprite *);
93void ee_free_sprite(struct ee_sprite *);
94
Note: See TracBrowser for help on using the repository browser.