]> git.lizzy.rs Git - shadowclad.git/blobdiff - src/engine/input.c
Create keybinds for scene and render debug functionalities
[shadowclad.git] / src / engine / input.c
index 01d3c41173d893059257933fb0de2e57b932144e..b8431434ff2a1423726a99aaef1cdb13e4edb9ba 100644 (file)
@@ -2,15 +2,33 @@
 
 #include <stdbool.h>
 
+#include "render.h"
+
 static void (*keyboardInputCallback) (int, int, int, int);
 
 
 
 void onKeyboardEvent(GLFWwindow* window, int key, int scancode, int action, int mods) {
-       bool handled = false;
+       if (!(mods & GLFW_MOD_CONTROL)) {
+               if (keyboardInputCallback) {
+                       keyboardInputCallback(key, scancode, action, mods);
+               }
+               return;
+       }
 
-       if (!handled && keyboardInputCallback) {
-               keyboardInputCallback(key, scancode, action, mods);
+       switch (key) {
+               case GLFW_KEY_1:
+                       if (action == GLFW_PRESS) {
+                               debugScene = !debugScene;
+                       }
+                       break;
+               case GLFW_KEY_2:
+                       if (action == GLFW_PRESS) {
+                               debugRender = !debugRender;
+                       }
+                       break;
+               default:
+                       break;
        }
 }