552e06aa27d6d55b3b4a57bf3c09f6b5a58cc466
[deeprace] / src / game.h
1 #ifndef GAME_H_
2 #define GAME_H_
3
4 enum {
5         GKEY_ESC        = 27,
6         GKEY_DEL        = 127,
7         GKEY_F1         = 256,
8         GKEY_F2, GKEY_F3, GKEY_F4, GKEY_F5, GKEY_F6, GKEY_F7,
9         GKEY_F8, GKEY_F9, GKEY_F10, GKEY_F11, GKEY_F12,
10         GKEY_UP, GKEY_DOWN, GKEY_LEFT, GKEY_RIGHT,
11         GKEY_PGUP, GKEY_PGDOWN,
12         GKEY_HOME, GKEY_END,
13         GKEY_INS
14 };
15
16
17 struct game_screen {
18         const char *name;
19
20         int (*init)(void);
21         void (*destroy)(void);
22         int (*start)(void);
23         void (*stop)(void);
24         void (*display)(void);
25         void (*reshape)(int, int);
26         void (*keyboard)(int, int);
27         void (*mouse)(int, int, int, int);
28         void (*motion)(int, int);
29 };
30
31 extern int mouse_x, mouse_y, mouse_state[3];
32 extern int win_width, win_height;
33 extern float win_aspect;
34
35 extern struct game_screen *cur_scr;
36
37
38 int game_init(void);
39 void game_shutdown(void);
40
41 void game_display(void);
42 void game_reshape(int x, int y);
43 void game_keyboard(int key, int press);
44 void game_mouse(int bn, int st, int x, int y);
45 void game_motion(int x, int y);
46
47 void game_chscr(struct game_screen *scr);
48
49 /* defined in main.c */
50 void game_swap_buffers(void);
51 void game_quit(void);
52
53 #endif  /* GAME_H_ */