fullscreen and mouse grab
[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 enum {
17         GKEY_MOD_SHIFT  = 1,
18         GKEY_MOD_CTRL   = 4,
19         GKEY_MOD_ALT    = 8
20 };
21
22
23 struct game_screen {
24         const char *name;
25
26         int (*init)(void);
27         void (*destroy)(void);
28         int (*start)(void);
29         void (*stop)(void);
30         void (*display)(void);
31         void (*reshape)(int, int);
32         void (*keyboard)(int, int);
33         void (*mouse)(int, int, int, int);
34         void (*motion)(int, int);
35 };
36
37 extern int mouse_x, mouse_y, mouse_state[3];
38 extern int mouse_grabbed;
39 extern unsigned int modkeys;
40 extern int win_width, win_height;
41 extern float win_aspect;
42 extern int fullscr;
43
44 extern struct game_screen *cur_scr;
45
46
47 int game_init(void);
48 void game_shutdown(void);
49
50 void game_display(void);
51 void game_reshape(int x, int y);
52 void game_keyboard(int key, int press);
53 void game_mouse(int bn, int st, int x, int y);
54 void game_motion(int x, int y);
55
56 void game_chscr(struct game_screen *scr);
57
58 /* defined in main.c */
59 void game_swap_buffers(void);
60 void game_quit(void);
61 void game_fullscreen(int fs);
62 void game_grabmouse(int grab);
63
64 #endif  /* GAME_H_ */