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