gba-trycatch

view src/sdlsys/gbasys.h @ 14:c398d834d64a

fixed the rendering bugs
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 23 Jun 2014 10:33:24 +0300
parents 73b5f2e5d18a
children
line source
1 /* fake gbasys.h for building on PCs with SDL */
2 #ifndef FAKE_GBASYS_H_
3 #define FAKE_GBASYS_H_
5 /* ---- fake gbasys/gfx.h ---- */
6 struct pixel_buffer {
7 int x, y, bpp;
8 void *pixels;
9 };
11 extern struct pixel_buffer *back_buffer, *front_buffer;
13 #define RGB(r, g, b)\
14 ((((b) >> 3) & 0x1f) << 11) |\
15 ((((g) >> 2) & 0x3f) << 5) |\
16 (((r) >> 3) & 0x1f)
18 #define GET_R(c) ((((c) >> 11) & 0x1f) << 3)
19 #define GET_G(c) ((((c) >> 5) & 0x3f) << 2)
20 #define GET_B(c) (((c) & 0x1f) << 3)
22 /* defined in main_sdl.c */
23 void flip(void);
24 void clear_buffer(struct pixel_buffer *pbuf, unsigned short color);
25 void set_palette(int idx, int r, int g, int b);
27 /* ---- fake gbasys/input.h ---- */
28 enum {
29 KEY_A = 1,
30 KEY_B = 2,
31 KEY_SELECT = 4,
32 KEY_START = 8,
33 KEY_RIGHT = 16,
34 KEY_LEFT = 32,
35 KEY_UP = 64,
36 KEY_DOWN = 128,
37 KEY_R = 256,
38 KEY_L = 512,
39 KEY_ALL = 1023
40 };
42 #define KEY_COUNT 14
44 int get_key_state(int key);
46 /* ---- fake gbasys/timer.h ---- */
47 unsigned long get_millisec(void);
49 #include "font.h"
51 #endif /* FAKE_GBASYS_H_ */