gba-trycatch

annotate src/sdlsys/gbasys.h @ 15:b755fb002f17

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 25 Jun 2014 17:02:48 +0300
parents 73b5f2e5d18a
children
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@9 25 void set_palette(int idx, int r, int g, int b);
nuclear@5 26
nuclear@5 27 /* ---- fake gbasys/input.h ---- */
nuclear@5 28 enum {
nuclear@5 29 KEY_A = 1,
nuclear@5 30 KEY_B = 2,
nuclear@5 31 KEY_SELECT = 4,
nuclear@5 32 KEY_START = 8,
nuclear@5 33 KEY_RIGHT = 16,
nuclear@5 34 KEY_LEFT = 32,
nuclear@5 35 KEY_UP = 64,
nuclear@5 36 KEY_DOWN = 128,
nuclear@5 37 KEY_R = 256,
nuclear@5 38 KEY_L = 512,
nuclear@5 39 KEY_ALL = 1023
nuclear@5 40 };
nuclear@5 41
nuclear@5 42 #define KEY_COUNT 14
nuclear@5 43
nuclear@5 44 int get_key_state(int key);
nuclear@5 45
nuclear@5 46 /* ---- fake gbasys/timer.h ---- */
nuclear@5 47 unsigned long get_millisec(void);
nuclear@5 48
nuclear@5 49 #include "font.h"
nuclear@5 50
nuclear@5 51 #endif /* FAKE_GBASYS_H_ */