diff options
Diffstat (limited to 'src/Core/Window.cpp')
| -rw-r--r-- | src/Core/Window.cpp | 19 |
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; |
