34 static double lastX = 0, lastY = 0;
35 glfwGetCursorPos(
renderer.getWindow(), &x, &y);
41 static bool prevEscDown =
false;
42 GLFWwindow* window =
renderer.getWindow();
43 bool escDown = glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS;
44 bool escPressed = escDown && !prevEscDown;
45 prevEscDown = escDown;
50 glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
52 glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
56 glfwGetCursorPos(window, &cx, &cy);
62 double dx = x - lastX;
63 double dy = lastY - y;
71 input.look = glm::vec2(0.0f);
72 input.movement = glm::vec3(0.0f);
79 input.look = glm::vec2(dx, dy);
81 GLFWwindow* window =
renderer.getWindow();
82 input.movement = glm::vec3(
83 (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS) - (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS),
84 (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS) - (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS),
85 (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) - (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
88 input.look = glm::vec2(0.0f);
89 input.movement = glm::vec3(0.0f);
96 input.look = glm::vec2(0.0f);
97 input.movement = glm::vec3(0.0f);
104 input.look = glm::vec2(dx, dy);
106 GLFWwindow* window =
renderer.getWindow();
107 input.movement = glm::vec3(
108 (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS) - (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS),
109 (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS) - (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS),
110 (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS) - (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
113 input.look = glm::vec2(0.0f);
114 input.movement = glm::vec3(0.0f);