-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessInput.cpp
More file actions
26 lines (25 loc) · 929 Bytes
/
processInput.cpp
File metadata and controls
26 lines (25 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "camera.h"
#include "processInput.h"
#define IMGUI_IMPL_OPENGL_LOADER_GLAD
#include "imgui.h"
extern Camera camera;
extern float deltaTime;
void processInput(GLFWwindow* window)
{
//ImGuiIO& io = ImGui::GetIO();
//if (!io.WantCaptureKeyboard) {
// processInput(window); // Your camera/WASD code
//}
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(window, true);
// camera user control
float cameraSpeed = 2.5f * deltaTime;
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
camera.ProcessKeyboard(FORWARD, deltaTime);
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
camera.ProcessKeyboard(BACKWARD, deltaTime);
if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)
camera.ProcessKeyboard(LEFT, deltaTime);
if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)
camera.ProcessKeyboard(RIGHT, deltaTime);
}