File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ class ENGINE_API Window {
4242
4343 void SetImGuiReady (bool ready) { m_imguiReady = ready; }
4444
45+ void SetRelativeMouseMode (bool enabled);
46+
4547 static int GetWidth () { return Width; }
4648 static int GetHeight () { return Height; }
4749
Original file line number Diff line number Diff line change 11#include < ECS/Components/FirstPersonController.hpp>
22#include < Physics/RigidbodyComponent.hpp>
3+ #include < Core/Application.hpp>
4+ #include < Window.hpp>
35#include < SDL3/SDL.h>
46#include < Events/Event.h>
57#include < Math/Math.hpp>
@@ -193,8 +195,8 @@ void FirstPersonController::SetEnabled(bool enabled) {
193195
194196 if (!camera) return ;
195197
196- SDL_Window* window = SDL_GetMouseFocus ();
197- SDL_SetWindowRelativeMouseMode (window, enabled);
198+ auto * app = Application::GetInstance ();
199+ if (app) app-> GetWindow (). SetRelativeMouseMode ( enabled);
198200 ToggleCursor (!enabled);
199201
200202 if (enabled) {
Original file line number Diff line number Diff line change 11#include < ECS/Components/FreeLookCameraController.hpp>
22#include < Physics/RigidbodyComponent.hpp>
3+ #include < Core/Application.hpp>
4+ #include < Window.hpp>
35#include < SDL3/SDL.h>
46#include < Events/Event.h>
57#include < Math/Math.hpp>
@@ -185,8 +187,8 @@ namespace Sleak {
185187 if (!camera)
186188 return ;
187189
188- SDL_Window* window = SDL_GetMouseFocus ();
189- SDL_SetWindowRelativeMouseMode (window, enabled);
190+ auto * app = Application::GetInstance ();
191+ if (app) app-> GetWindow (). SetRelativeMouseMode ( enabled);
190192
191193 ToggleCursor (!enabled);
192194
Original file line number Diff line number Diff line change @@ -186,6 +186,10 @@ void Window::SetFullScreen(bool isFullscreen) {
186186 }
187187}
188188
189+ void Window::SetRelativeMouseMode (bool enabled) {
190+ SDL_SetWindowRelativeMouseMode (SDLWindow, enabled);
191+ }
192+
189193void Window::Close () {
190194 event.type = SDL_EVENT_QUIT ;
191195 SDL_Quit ();
You can’t perform that action at this time.
0 commit comments