eobish
diff src/fblib.h @ 2:cdbcae5b3b98
added fblib
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 18 Jan 2015 03:16:37 +0200 |
parents | |
children | ce0548d24918 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/fblib.h Sun Jan 18 03:16:37 2015 +0200 1.3 @@ -0,0 +1,47 @@ 1.4 +#ifndef FBLIB_H_ 1.5 +#define FBLIB_H_ 1.6 + 1.7 +#ifdef __cplusplus 1.8 +extern "C" { 1.9 +#endif 1.10 + 1.11 +/* pixel formats for various bpp values 1.12 + * 32: [R8][G8][B8][X8] or [X|B|G|R] (little endian) 1.13 + * 24: [R8][G8][B8] 1.14 + * 16: [R5|G6|B5] 1.15 + * 15: [R5|G5|B5] 1.16 + * 8: [I8] (8 bit color index) 1.17 + */ 1.18 +int fb_init(int width, int height, int bpp); 1.19 +void fb_shutdown(void); 1.20 + 1.21 +int fb_get_width(void); 1.22 +int fb_get_height(void); 1.23 +int fb_get_bpp(void); 1.24 + 1.25 +void *fb_begin_frame(void); 1.26 +void fb_end_frame(void); 1.27 + 1.28 +void fb_set_palette(int *colors); 1.29 +void fb_set_palette_range(int start, int count, int *colors); 1.30 +void fb_set_palette_entry(int idx, int r, int g, int b); 1.31 + 1.32 +/* event handling */ 1.33 +int fb_key_state(int key); 1.34 +int fb_mouse_state(int bn, int *x, int *y); 1.35 + 1.36 +void fb_keyboard_callback(void (*func)(int, int, void*), void *cls); 1.37 +void fb_mouse_button_callback(void (*func)(int, int, int, int, void*), void *cls); 1.38 +void fb_mouse_motion_callback(void (*func)(int, int, void*), void *cls); 1.39 + 1.40 +int fb_process_events(void); 1.41 + 1.42 +/* misc */ 1.43 +unsigned long fb_get_time(void); 1.44 + 1.45 +#ifdef __cplusplus 1.46 +} 1.47 +#endif 1.48 + 1.49 + 1.50 +#endif /* FBLIB_H_ */