gba-trycatch
view src/sdlsys/gbasys.h @ 6:73b5f2e5d18a
first triangle on screen
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 18 Jun 2014 04:13:02 +0300 |
parents | 850be43b3135 |
children | b0ed38f13261 |
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);
26 /* ---- fake gbasys/input.h ---- */
27 enum {
28 KEY_A = 1,
29 KEY_B = 2,
30 KEY_SELECT = 4,
31 KEY_START = 8,
32 KEY_RIGHT = 16,
33 KEY_LEFT = 32,
34 KEY_UP = 64,
35 KEY_DOWN = 128,
36 KEY_R = 256,
37 KEY_L = 512,
38 KEY_ALL = 1023
39 };
41 #define KEY_COUNT 14
43 int get_key_state(int key);
45 /* ---- fake gbasys/timer.h ---- */
46 unsigned long get_millisec(void);
48 #include "font.h"
50 #endif /* FAKE_GBASYS_H_ */