fe06daf87b73588e25d12ee64c644525000c8fa0
[laserbrain_demo] / src / app.h
1 #ifndef APP_H_
2 #define APP_H_
3
4 #include "texture.h"
5 #include "scene.h"
6
7 extern long time_msec;
8 extern int win_width, win_height;
9 extern float win_aspect;
10 extern bool opt_gear_wireframe;
11 extern bool fb_srgb;
12
13 extern TextureSet texman;
14 extern SceneSet sceneman;
15
16 extern unsigned int sdr_ltmap, sdr_ltmap_notex;
17
18 extern int fpexcept_enabled;    // int so that C modules may fwd-delcare and use it
19
20 enum {
21         MOD_SHIFT       = 1,
22         MOD_ALT         = 2,
23         MOD_CTRL        = 4
24 };
25
26 /* special keys */
27 enum {
28         KEY_DEL = 127,
29         KEY_LEFT,
30         KEY_RIGHT,
31         KEY_UP,
32         KEY_DOWN,
33         KEY_PGUP,
34         KEY_PGDOWN,
35         KEY_HOME,
36         KEY_END,
37         KEY_F1,
38         KEY_F2,
39         KEY_F3,
40         KEY_F4,
41         KEY_F5,
42         KEY_F6,
43         KEY_F7,
44         KEY_F8,
45         KEY_F9,
46         KEY_F10,
47         KEY_F11,
48         KEY_F12
49 };
50
51 /* XXX make sure these match with SDL_GameControllerButton */
52 enum {
53         GPAD_A,
54         GPAD_B,
55         GPAD_X,
56         GPAD_Y,
57         GPAD_BACK,
58         GPAD_GUIDE,
59         GPAD_START,
60         GPAD_LSTICK,
61         GPAD_RSTICK,
62         GPAD_L,
63         GPAD_R,
64         GPAD_UP,
65         GPAD_DOWN,
66         GPAD_LEFT,
67         GPAD_RIGHT,
68 };
69
70 bool app_init(int argc, char **argv);
71 void app_cleanup();
72
73 void app_display();
74 void app_reshape(int x, int y);
75
76 void app_keyboard(int key, bool pressed);
77 void app_mouse_button(int bn, bool pressed, int x, int y);
78 void app_mouse_motion(int x, int y);
79 void app_mouse_delta(int dx, int dy);
80 void app_mouse_wheel(int dir);
81
82 void app_gamepad_axis(int axis, float val);
83 void app_gamepad_button(int bn, bool pressed);
84
85 // the following functions are implemented by the backend (main.cc)
86 void app_quit();
87 void app_swap_buffers();
88 unsigned int app_get_modifiers();
89
90 void app_resize(int x, int y);
91 void app_fullscreen(bool fs);
92 void app_toggle_fullscreen();
93 bool app_is_fullscreen();
94 void app_grab_mouse(bool grab);
95 void app_toggle_grab_mouse();
96 bool app_is_mouse_grabbed();
97
98 #endif  // APP_H_