annotate 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 |
rev |
line source |
nuclear@5
|
1 /* fake gbasys.h for building on PCs with SDL */
|
nuclear@5
|
2 #ifndef FAKE_GBASYS_H_
|
nuclear@5
|
3 #define FAKE_GBASYS_H_
|
nuclear@5
|
4
|
nuclear@5
|
5 /* ---- fake gbasys/gfx.h ---- */
|
nuclear@5
|
6 struct pixel_buffer {
|
nuclear@5
|
7 int x, y, bpp;
|
nuclear@5
|
8 void *pixels;
|
nuclear@5
|
9 };
|
nuclear@5
|
10
|
nuclear@6
|
11 extern struct pixel_buffer *back_buffer, *front_buffer;
|
nuclear@5
|
12
|
nuclear@5
|
13 #define RGB(r, g, b)\
|
nuclear@6
|
14 ((((b) >> 3) & 0x1f) << 11) |\
|
nuclear@6
|
15 ((((g) >> 2) & 0x3f) << 5) |\
|
nuclear@5
|
16 (((r) >> 3) & 0x1f)
|
nuclear@5
|
17
|
nuclear@6
|
18 #define GET_R(c) ((((c) >> 11) & 0x1f) << 3)
|
nuclear@6
|
19 #define GET_G(c) ((((c) >> 5) & 0x3f) << 2)
|
nuclear@5
|
20 #define GET_B(c) (((c) & 0x1f) << 3)
|
nuclear@5
|
21
|
nuclear@5
|
22 /* defined in main_sdl.c */
|
nuclear@5
|
23 void flip(void);
|
nuclear@5
|
24 void clear_buffer(struct pixel_buffer *pbuf, unsigned short color);
|
nuclear@5
|
25
|
nuclear@5
|
26 /* ---- fake gbasys/input.h ---- */
|
nuclear@5
|
27 enum {
|
nuclear@5
|
28 KEY_A = 1,
|
nuclear@5
|
29 KEY_B = 2,
|
nuclear@5
|
30 KEY_SELECT = 4,
|
nuclear@5
|
31 KEY_START = 8,
|
nuclear@5
|
32 KEY_RIGHT = 16,
|
nuclear@5
|
33 KEY_LEFT = 32,
|
nuclear@5
|
34 KEY_UP = 64,
|
nuclear@5
|
35 KEY_DOWN = 128,
|
nuclear@5
|
36 KEY_R = 256,
|
nuclear@5
|
37 KEY_L = 512,
|
nuclear@5
|
38 KEY_ALL = 1023
|
nuclear@5
|
39 };
|
nuclear@5
|
40
|
nuclear@5
|
41 #define KEY_COUNT 14
|
nuclear@5
|
42
|
nuclear@5
|
43 int get_key_state(int key);
|
nuclear@5
|
44
|
nuclear@5
|
45 /* ---- fake gbasys/timer.h ---- */
|
nuclear@5
|
46 unsigned long get_millisec(void);
|
nuclear@5
|
47
|
nuclear@5
|
48 #include "font.h"
|
nuclear@5
|
49
|
nuclear@5
|
50 #endif /* FAKE_GBASYS_H_ */
|