fix: relative mouse mode resets

This commit is contained in:
2025-10-16 20:03:18 +02:00
parent 800d0eb8e4
commit faf9b67222

View File

@ -31,6 +31,8 @@ Window::Window(const char* title, int width, int height) {
} }
SDL_SetWindowRelativeMouseMode(m_handle, true); SDL_SetWindowRelativeMouseMode(m_handle, true);
SDL_Rect boundaries = {0, 0, m_width, m_height};
SDL_SetWindowMouseRect(m_handle, &boundaries);
m_context = SDL_GL_CreateContext(m_handle); m_context = SDL_GL_CreateContext(m_handle);
@ -121,6 +123,9 @@ void Window::ProcessEvents() {
width, width,
height); height);
Dispatch(WindowResized{ m_width, m_height }); Dispatch(WindowResized{ m_width, m_height });
SDL_SetWindowRelativeMouseMode(m_handle, true);
SDL_Rect boundaries = {0, 0, m_width, m_height};
SDL_SetWindowMouseRect(m_handle, &boundaries);
} }
break; break;
default: break; default: break;