diff options
| author | hachem <im@hachem.wtf> | 2025-08-12 18:41:26 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2025-08-12 18:41:26 +0200 |
| commit | 7e06a916e6a385c37075abcb83d14b8c1fef7bc0 (patch) | |
| tree | 8054d96e89d43b0f98b75af726079d723a70ca2a /src/core/window.cpp | |
| parent | 50cdd344a3ed87c75a67739e2ffd34762e9b0895 (diff) | |
feat: camera
Diffstat (limited to 'src/core/window.cpp')
| -rw-r--r-- | src/core/window.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
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; |
