fullscreen, mouse grab, stuff
[laserbrain_demo] / src / main.cc
index 45b5632..f21c406 100644 (file)
@@ -90,6 +90,47 @@ unsigned int app_get_modifiers()
        return modkeys;
 }
 
+void app_resize(int x, int y)
+{
+       SDL_SetWindowSize(win, x, y);
+}
+
+void app_fullscreen(bool fs)
+{
+       SDL_SetWindowFullscreen(win, fs ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
+       fullscreen = fs;
+}
+
+void app_toggle_fullscreen()
+{
+       app_fullscreen(!fullscreen);
+}
+
+bool app_is_fullscreen()
+{
+       return fullscreen;
+}
+
+void app_grab_mouse(bool grab)
+{
+       /*SDL_SetWindowGrab(win, grab ? SDL_TRUE : SDL_FALSE);
+       SDL_ShowCursor(grab ? 1 : 0);
+       */
+       SDL_SetRelativeMouseMode(grab ? SDL_TRUE : SDL_FALSE);
+       mouse_grabbed = grab;
+}
+
+void app_toggle_grab_mouse()
+{
+       app_grab_mouse(!mouse_grabbed);
+}
+
+bool app_is_mouse_grabbed()
+{
+       return mouse_grabbed;
+}
+
+
 static bool init()
 {
        glewInit();