diff options
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; |
