00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00097 #ifndef __CACA_H__
00098 #define __CACA_H__
00099
00100 #ifdef __cplusplus
00101 extern "C"
00102 {
00103 #endif
00104
00109 enum caca_color
00110 {
00111 CACA_COLOR_BLACK = 0,
00112 CACA_COLOR_BLUE = 1,
00113 CACA_COLOR_GREEN = 2,
00114 CACA_COLOR_CYAN = 3,
00115 CACA_COLOR_RED = 4,
00116 CACA_COLOR_MAGENTA = 5,
00117 CACA_COLOR_BROWN = 6,
00118 CACA_COLOR_LIGHTGRAY = 7,
00119 CACA_COLOR_DARKGRAY = 8,
00120 CACA_COLOR_LIGHTBLUE = 9,
00121 CACA_COLOR_LIGHTGREEN = 10,
00122 CACA_COLOR_LIGHTCYAN = 11,
00123 CACA_COLOR_LIGHTRED = 12,
00124 CACA_COLOR_LIGHTMAGENTA = 13,
00125 CACA_COLOR_YELLOW = 14,
00126 CACA_COLOR_WHITE = 15
00127 };
00128
00134 enum caca_feature
00135 {
00136 CACA_BACKGROUND = 0x10,
00137 CACA_BACKGROUND_BLACK = 0x11,
00138 CACA_BACKGROUND_SOLID = 0x12,
00139 #define CACA_BACKGROUND_MIN 0x11
00140 #define CACA_BACKGROUND_MAX 0x12
00142 CACA_ANTIALIASING = 0x20,
00143 CACA_ANTIALIASING_NONE = 0x21,
00144 CACA_ANTIALIASING_PREFILTER = 0x22,
00145 #define CACA_ANTIALIASING_MIN 0x21
00146 #define CACA_ANTIALIASING_MAX 0x22
00148 CACA_DITHERING = 0x30,
00149 CACA_DITHERING_NONE = 0x31,
00150 CACA_DITHERING_ORDERED2 = 0x32,
00151 CACA_DITHERING_ORDERED4 = 0x33,
00152 CACA_DITHERING_ORDERED8 = 0x34,
00153 CACA_DITHERING_RANDOM = 0x35,
00154 #define CACA_DITHERING_MIN 0x31
00155 #define CACA_DITHERING_MAX 0x35
00157 CACA_FEATURE_UNKNOWN = 0xffff
00158 };
00159
00160
00161
00162
00163 #if !defined(_DOXYGEN_SKIP_ME)
00164 #define caca_dithering caca_feature
00165 #define caca_set_dithering caca_set_feature
00166 #define caca_get_dithering_name caca_get_feature_name
00167 #define CACA_DITHER_NONE CACA_DITHERING_NONE
00168 #define CACA_DITHER_ORDERED CACA_DITHERING_ORDERED8
00169 #define CACA_DITHER_RANDOM CACA_DITHERING_RANDOM
00170 #endif
00171
00176 enum caca_event
00177 {
00178 CACA_EVENT_NONE = 0x00000000,
00179 CACA_EVENT_KEY_PRESS = 0x01000000,
00180 CACA_EVENT_KEY_RELEASE = 0x02000000,
00181 CACA_EVENT_MOUSE_PRESS = 0x04000000,
00182 CACA_EVENT_MOUSE_RELEASE = 0x08000000,
00183 CACA_EVENT_MOUSE_MOTION = 0x10000000,
00184 CACA_EVENT_RESIZE = 0x20000000,
00185 CACA_EVENT_ANY = 0xff000000
00186 };
00187
00193 enum caca_key
00194 {
00195 CACA_KEY_UNKNOWN = 0,
00197
00198 CACA_KEY_BACKSPACE = 8,
00199 CACA_KEY_TAB = 9,
00200 CACA_KEY_RETURN = 13,
00201 CACA_KEY_PAUSE = 19,
00202 CACA_KEY_ESCAPE = 27,
00203 CACA_KEY_DELETE = 127,
00205
00206
00207 CACA_KEY_UP = 273,
00208 CACA_KEY_DOWN = 274,
00209 CACA_KEY_LEFT = 275,
00210 CACA_KEY_RIGHT = 276,
00212 CACA_KEY_INSERT = 277,
00213 CACA_KEY_HOME = 278,
00214 CACA_KEY_END = 279,
00215 CACA_KEY_PAGEUP = 280,
00216 CACA_KEY_PAGEDOWN = 281,
00218 CACA_KEY_F1 = 282,
00219 CACA_KEY_F2 = 283,
00220 CACA_KEY_F3 = 284,
00221 CACA_KEY_F4 = 285,
00222 CACA_KEY_F5 = 286,
00223 CACA_KEY_F6 = 287,
00224 CACA_KEY_F7 = 288,
00225 CACA_KEY_F8 = 289,
00226 CACA_KEY_F9 = 290,
00227 CACA_KEY_F10 = 291,
00228 CACA_KEY_F11 = 292,
00229 CACA_KEY_F12 = 293,
00230 CACA_KEY_F13 = 294,
00231 CACA_KEY_F14 = 295,
00232 CACA_KEY_F15 = 296
00233 };
00234
00241 int caca_init(void);
00242 void caca_set_delay(unsigned int);
00243 enum caca_feature caca_get_feature(enum caca_feature);
00244 void caca_set_feature(enum caca_feature);
00245 char const *caca_get_feature_name(enum caca_feature);
00246 unsigned int caca_get_rendertime(void);
00247 unsigned int caca_get_width(void);
00248 unsigned int caca_get_height(void);
00249 int caca_set_window_title(char const *);
00250 unsigned int caca_get_window_width(void);
00251 unsigned int caca_get_window_height(void);
00252 void caca_refresh(void);
00253 void caca_end(void);
00254
00255
00262 unsigned int caca_get_event(unsigned int);
00263 unsigned int caca_wait_event(unsigned int);
00264 unsigned int caca_get_mouse_x(void);
00265 unsigned int caca_get_mouse_y(void);
00266
00267
00273 void caca_set_color(enum caca_color, enum caca_color);
00274 enum caca_color caca_get_fg_color(void);
00275 enum caca_color caca_get_bg_color(void);
00276 char const *caca_get_color_name(enum caca_color);
00277 void caca_putchar(int, int, char);
00278 void caca_putstr(int, int, char const *);
00279 void caca_printf(int, int, char const *, ...);
00280 void caca_clear(void);
00281
00282
00289 void caca_draw_line(int, int, int, int, char);
00290 void caca_draw_polyline(int const x[], int const y[], int, char);
00291 void caca_draw_thin_line(int, int, int, int);
00292 void caca_draw_thin_polyline(int const x[], int const y[], int);
00293
00294 void caca_draw_circle(int, int, int, char);
00295 void caca_draw_ellipse(int, int, int, int, char);
00296 void caca_draw_thin_ellipse(int, int, int, int);
00297 void caca_fill_ellipse(int, int, int, int, char);
00298
00299 void caca_draw_box(int, int, int, int, char);
00300 void caca_draw_thin_box(int, int, int, int);
00301 void caca_fill_box(int, int, int, int, char);
00302
00303 void caca_draw_triangle(int, int, int, int, int, int, char);
00304 void caca_draw_thin_triangle(int, int, int, int, int, int);
00305 void caca_fill_triangle(int, int, int, int, int, int, char);
00306
00307
00313 int caca_rand(int, int);
00314 unsigned int caca_sqrt(unsigned int);
00315
00316
00323 struct caca_sprite;
00324 struct caca_sprite * caca_load_sprite(char const *);
00325 int caca_get_sprite_frames(struct caca_sprite const *);
00326 int caca_get_sprite_width(struct caca_sprite const *, int);
00327 int caca_get_sprite_height(struct caca_sprite const *, int);
00328 int caca_get_sprite_dx(struct caca_sprite const *, int);
00329 int caca_get_sprite_dy(struct caca_sprite const *, int);
00330 void caca_draw_sprite(int, int, struct caca_sprite const *, int);
00331 void caca_free_sprite(struct caca_sprite *);
00332
00333
00340 struct caca_bitmap;
00341 struct caca_bitmap *caca_create_bitmap(unsigned int, unsigned int,
00342 unsigned int, unsigned int,
00343 unsigned int, unsigned int,
00344 unsigned int, unsigned int);
00345 void caca_set_bitmap_palette(struct caca_bitmap *,
00346 unsigned int r[], unsigned int g[],
00347 unsigned int b[], unsigned int a[]);
00348 void caca_draw_bitmap(int, int, int, int, struct caca_bitmap const *, void *);
00349 void caca_free_bitmap(struct caca_bitmap *);
00350
00351
00352 #ifdef __cplusplus
00353 }
00354 #endif
00355
00356 #endif