aboutsummaryrefslogtreecommitdiff
path: root/src/Core/Window.cpp
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2025-08-12 18:41:26 +0200
committerhachem <im@hachem.wtf>2025-08-12 18:41:26 +0200
commit8cf6858a6cd958f31521c4ce680cf2011bfb7cc3 (patch)
tree56492ce9db686b719ec16f51b7a7078c41443899 /src/Core/Window.cpp
parenta2ec7dabd48a70ea69623406ddd0f8f97af403c8 (diff)
[add]: Camera
Diffstat (limited to 'src/Core/Window.cpp')
-rw-r--r--src/Core/Window.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/Core/Window.cpp b/src/Core/Window.cpp
index 440aeb1..ff451fd 100644
--- a/src/Core/Window.cpp
+++ b/src/Core/Window.cpp
@@ -44,7 +44,6 @@ namespace Donut
glfwMakeContextCurrent(m_Window);
- // Initialize GLAD
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
{
std::cout << "Failed to initialize GLAD!" << std::endl;
@@ -91,6 +90,24 @@ namespace Donut
return glfwWindowShouldClose(m_Window) || m_IsClosed;
}
+ void Window::SetCursorLocked(bool locked)
+ {
+ m_CursorLocked = locked;
+ if (locked)
+ glfwSetInputMode(m_Window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
+ else
+ glfwSetInputMode(m_Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
+ }
+
+ void Window::SetCursorVisible(bool visible)
+ {
+ m_CursorVisible = visible;
+ if (visible)
+ glfwSetInputMode(m_Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
+ else
+ glfwSetInputMode(m_Window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
+ }
+
void Window::GLFWErrorCallback(int error, const char* description)
{
std::cout << "GLFW Error (" << error << "): " << description << std::endl;