Added fullscreen option
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 24 Nov 2020 00:25:35 +0000 (18:25 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Tue, 24 Nov 2020 00:25:35 +0000 (18:25 -0600)
src/sim.cpp

index 638be06eb4a8b43f271884c40ab5b49a75c006d7..4170abcfc75988c38e5c5f088df76d4da6c84395 100644 (file)
@@ -26,6 +26,23 @@ glfw_key_handler(GLFWwindow* window, i32 key, i32 scancode, i32 action, i32 mods
 {
        if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
                glfwSetWindowShouldClose(window, 1);
+
+    if (key == GLFW_KEY_F && action == GLFW_PRESS)
+    {
+        persist bool is_fullscreen = false;
+        is_fullscreen = !is_fullscreen;
+
+        if (is_fullscreen)
+        {
+            GLFWmonitor* primary_mon = glfwGetPrimaryMonitor();
+            const GLFWvidmode* vidmode = glfwGetVideoMode(primary_mon);
+            glfwSetWindowMonitor(window, primary_mon, 0, 0, vidmode->width, vidmode->height, GLFW_DONT_CARE);
+        }
+        else
+        {
+            glfwSetWindowMonitor(window, NULL, 0, 0, 800, 600, GLFW_DONT_CARE);
+        }
+    }
 }
 
 internal void