From 7e06a916e6a385c37075abcb83d14b8c1fef7bc0 Mon Sep 17 00:00:00 2001 From: hachem Date: Tue, 12 Aug 2025 18:41:26 +0200 Subject: feat: camera --- src/core/window.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/core/window.cpp') diff --git a/src/core/window.cpp b/src/core/window.cpp index 77ef885..26c134c 100644 --- a/src/core/window.cpp +++ b/src/core/window.cpp @@ -90,6 +90,24 @@ namespace Donut return glfwWindowShouldClose(m_window) || m_is_closed; } + void Window::set_cursor_locked(bool locked) + { + m_cursor_locked = locked; + if (locked) + glfwSetInputMode(m_window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); + else + glfwSetInputMode(m_window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); + } + + void Window::set_cursor_visible(bool visible) + { + m_cursor_visible = visible; + if (visible) + glfwSetInputMode(m_window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); + else + glfwSetInputMode(m_window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); + } + void Window::glfw_error_callback(int error, const char* description) { std::cout << "GLFW Error (" << error << "): " << description << std::endl; -- cgit v1.3