From 5d52c9cdaf48e3cec8cbab741bb322810e43a08a Mon Sep 17 00:00:00 2001 From: Faerbit Date: Sun, 15 Mar 2015 15:02:30 +0100 Subject: [PATCH] Only register keypresses after loading which are not escape. --- game/main.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/game/main.cc b/game/main.cc index 89a8059..7cebbb5 100644 --- a/game/main.cc +++ b/game/main.cc @@ -13,7 +13,7 @@ static void resizeCallback(GLFWwindow* window, int newWidth, int newHeight) static void keyCallback(GLFWwindow* _window, int _key, int, int _action, int) { - if (!app.isGameStarted() && _action == GLFW_PRESS) { + if (!app.isGameStarted() && _action == GLFW_PRESS && _key != GLFW_KEY_ESCAPE) { app.startGame(); } if (_key == GLFW_KEY_ESCAPE && _action == GLFW_PRESS) { @@ -145,10 +145,7 @@ int main( int argc, char *argv[] ) glfwSetInputMode(window, GLFW_STICKY_KEYS, 1); // set Callbacks glfwSetWindowSizeCallback(window, resizeCallback); - glfwSetKeyCallback(window, keyCallback ); - glfwSetScrollCallback(window, scrollCallback ); glfwSetWindowFocusCallback(window, focusCallback); - glfwSetMouseButtonCallback(window, mouseCallback); // Enable vertical sync (on cards that support it) with parameter 1 - 0 means off glfwSwapInterval( 0 ); @@ -157,6 +154,10 @@ int main( int argc, char *argv[] ) glBindFramebuffer( GL_FRAMEBUFFER, 0 ); glfwSwapBuffers(window); app.initLevel(); + + glfwSetKeyCallback(window, keyCallback ); + glfwSetScrollCallback(window, scrollCallback ); + glfwSetMouseButtonCallback(window, mouseCallback); int frameCount = 0;