eobish

diff src/fblib.c @ 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.c	Sun Jan 18 03:16:37 2015 +0200
     1.3 @@ -0,0 +1,48 @@
     1.4 +#include "fblib.h"
     1.5 +#include "fblibimp.h"
     1.6 +
     1.7 +void fb_set_palette(int *colors)
     1.8 +{
     1.9 +	fb_set_palette_range(0, 256, colors);
    1.10 +}
    1.11 +
    1.12 +void fb_set_palette_entry(int idx, int r, int g, int b)
    1.13 +{
    1.14 +	int col[3];
    1.15 +	col[0] = r;
    1.16 +	col[1] = g;
    1.17 +	col[2] = b;
    1.18 +
    1.19 +	fb_set_palette_range(idx, 1, col);
    1.20 +}
    1.21 +
    1.22 +int fb_key_state(int key)
    1.23 +{
    1.24 +	if(key < 256) {
    1.25 +		return fb_inp.key[key];
    1.26 +	}
    1.27 +	return 0;
    1.28 +}
    1.29 +
    1.30 +int fb_mouse_state(int bn, int *x, int *y)
    1.31 +{
    1.32 +	return 0;
    1.33 +}
    1.34 +
    1.35 +void fb_keyboard_callback(void (*func)(int, int, void*), void *cls)
    1.36 +{
    1.37 +	fb_cb.keyb = func;
    1.38 +	fb_cb.keyb_data = cls;
    1.39 +}
    1.40 +
    1.41 +void fb_mouse_button_callback(void (*func)(int, int, int, int, void*), void *cls)
    1.42 +{
    1.43 +	fb_cb.button = func;
    1.44 +	fb_cb.button_data = cls;
    1.45 +}
    1.46 +
    1.47 +void fb_mouse_motion_callback(void (*func)(int, int, void*), void *cls)
    1.48 +{
    1.49 +	fb_cb.motion = func;
    1.50 +	fb_cb.motion_data = cls;
    1.51 +}