]> git.lizzy.rs Git - shadowclad.git/commitdiff
Preliminary troubleshooting for #28 28-input-rollover
authoroutfrost <kotlet.bahn@gmail.com>
Fri, 26 Jun 2020 22:20:30 +0000 (00:20 +0200)
committeroutfrost <kotlet.bahn@gmail.com>
Fri, 26 Jun 2020 22:20:30 +0000 (00:20 +0200)
src/game/input.c
src/main.c

index bf4ab03ebab671bb0ef44f52d443f84263a946a7..10c290bee71636088a70c2b62eb1025c65f1bce9 100644 (file)
@@ -1,8 +1,26 @@
 #include "input.h"
 
+#include "engine/logger.h"
+
 #include "player.h"
 
 void onKeyboardEvent(GLFWwindow* window, int key, int scancode, int action, int mods) {
+       const char* actionName;
+       switch (action) {
+               case GLFW_PRESS:
+                       actionName = "GLFW_PRESS";
+                       break;
+               case GLFW_REPEAT:
+                       actionName = "GLFW_REPEAT";
+                       break;
+               case GLFW_RELEASE:
+                       actionName = "GLFW_RELEASE";
+                       break;
+               default:
+                       actionName = "(unrecognised action)";
+                       break;
+       }
+       //logDebug("window %p, key %d, action %s", window, key, actionName);
        switch (key) {
                case GLFW_KEY_W:
                        if (action == GLFW_PRESS) {
index c99553975127536e616760c5f0ef63cc80c78307..ccffa980e4727d26f2c3040121af082d13d6ddb0 100644 (file)
@@ -74,6 +74,13 @@ int main(/*int argc, char** argv*/) {
                updatePlayer(delta);
                renderFrame(window);
                glfwPollEvents();
+
+               int wState = glfwGetKey(window, GLFW_KEY_W);
+               int sState = glfwGetKey(window, GLFW_KEY_S);
+               int aState = glfwGetKey(window, GLFW_KEY_A);
+               int dState = glfwGetKey(window, GLFW_KEY_D);
+
+               logDebug("%d %d %d %d", wState, sState, aState, dState);
        }
 
        glfwTerminate();