@@ -20,16 +20,23 @@ Camera::Camera(const glm::vec3& position, const glm::vec3& up, const float yaw,
2020
2121/* **********************************************************************************/
2222void Camera::Update (const double deltaTime) {
23- // Update view from mouse movement
24- updateView ();
25-
26- // Update Keyboard
27- if (Input::GetInstance ().IsKeyHeld (GLFW_KEY_W)) { processKeyboard (Direction::FORWARD, deltaTime); }
28- if (Input::GetInstance ().IsKeyHeld (GLFW_KEY_S)) { processKeyboard (Direction::BACKWARD, deltaTime); }
29- if (Input::GetInstance ().IsKeyHeld (GLFW_KEY_A)) { processKeyboard (Direction::LEFT, deltaTime); }
30- if (Input::GetInstance ().IsKeyHeld (GLFW_KEY_D)) { processKeyboard (Direction::RIGHT, deltaTime); }
31- if (Input::GetInstance ().IsKeyHeld (GLFW_KEY_SPACE)) { processKeyboard (Direction::UP, deltaTime); }
32- if (Input::GetInstance ().IsKeyHeld (GLFW_KEY_LEFT_CONTROL)) { processKeyboard (Direction::DOWN, deltaTime); }
23+
24+ if (Input::GetInstance ().IsKeyPressed (GLFW_KEY_TAB)) {
25+ m_shouldUpdate = !m_shouldUpdate;
26+ }
27+
28+ if (m_shouldUpdate) {
29+ // Update view from mouse movement
30+ updateView ();
31+
32+ // Update Keyboard
33+ if (Input::GetInstance ().IsKeyHeld (GLFW_KEY_W)) { processKeyboard (Direction::FORWARD, deltaTime); }
34+ if (Input::GetInstance ().IsKeyHeld (GLFW_KEY_S)) { processKeyboard (Direction::BACKWARD, deltaTime); }
35+ if (Input::GetInstance ().IsKeyHeld (GLFW_KEY_A)) { processKeyboard (Direction::LEFT, deltaTime); }
36+ if (Input::GetInstance ().IsKeyHeld (GLFW_KEY_D)) { processKeyboard (Direction::RIGHT, deltaTime); }
37+ if (Input::GetInstance ().IsKeyHeld (GLFW_KEY_SPACE)) { processKeyboard (Direction::UP, deltaTime); }
38+ if (Input::GetInstance ().IsKeyHeld (GLFW_KEY_LEFT_CONTROL)) { processKeyboard (Direction::DOWN, deltaTime); }
39+ }
3340}
3441
3542/* **********************************************************************************/
0 commit comments