simple ubershader system, reflection debugging
[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 int vp_width, vp_height; // viewport size differs from win size during VR eye rendering
11 extern float win_aspect;
12 extern bool opt_gear_wireframe;
13 extern bool fb_srgb;
14
15 extern TextureSet texman;
16 extern SceneSet sceneman;
17
18 extern ExSelection exsel_active;        // active (info/interact) exhibit
19 extern ExSelection exsel_grab_left, exsel_grab_right; // grabbed on each hand
20 extern ExSelection exsel_hover;         // hover
21
22 extern unsigned int dbg_key_pending;
23
24 extern int fpexcept_enabled;    // int so that C modules may fwd-delcare and use it
25
26 enum {
27         MOD_SHIFT       = 1,
28         MOD_ALT         = 2,
29         MOD_CTRL        = 4
30 };
31
32 /* special keys */
33 enum {
34         KEY_DEL = 127,
35         KEY_LEFT,
36         KEY_RIGHT,
37         KEY_UP,
38         KEY_DOWN,
39         KEY_PGUP,
40         KEY_PGDOWN,
41         KEY_HOME,
42         KEY_END,
43         KEY_F1,
44         KEY_F2,
45         KEY_F3,
46         KEY_F4,
47         KEY_F5,
48         KEY_F6,
49         KEY_F7,
50         KEY_F8,
51         KEY_F9,
52         KEY_F10,
53         KEY_F11,
54         KEY_F12
55 };
56
57 /* XXX make sure these match with SDL_GameControllerButton */
58 enum {
59         GPAD_A,
60         GPAD_B,
61         GPAD_X,
62         GPAD_Y,
63         GPAD_BACK,
64         GPAD_GUIDE,
65         GPAD_START,
66         GPAD_LSTICK,
67         GPAD_RSTICK,
68         GPAD_L,
69         GPAD_R,
70         GPAD_UP,
71         GPAD_DOWN,
72         GPAD_LEFT,
73         GPAD_RIGHT,
74 };
75
76 bool app_init(int argc, char **argv);
77 void app_cleanup();
78
79 void app_display();
80 void app_reshape(int x, int y);
81
82 void app_keyboard(int key, bool pressed);
83 void app_mouse_button(int bn, bool pressed, int x, int y);
84 void app_mouse_motion(int x, int y);
85 void app_mouse_delta(int dx, int dy);
86 void app_mouse_wheel(int dir);
87
88 void app_gamepad_axis(int axis, float val);
89 void app_gamepad_button(int bn, bool pressed);
90
91 // the following functions are implemented by the backend (main.cc)
92 void app_quit();
93 void app_swap_buffers();
94 unsigned int app_get_modifiers();
95
96 void app_resize(int x, int y);
97 void app_fullscreen(bool fs);
98 void app_toggle_fullscreen();
99 bool app_is_fullscreen();
100 void app_grab_mouse(bool grab);
101 void app_toggle_grab_mouse();
102 bool app_is_mouse_grabbed();
103
104 #endif  // APP_H_