diff --git a/Source/Engine/Engine/Screen.cpp b/Source/Engine/Engine/Screen.cpp index 09be67ab8..e2a511d40 100644 --- a/Source/Engine/Engine/Screen.cpp +++ b/Source/Engine/Engine/Screen.cpp @@ -116,6 +116,19 @@ CursorLockMode Screen::GetCursorLock() void Screen::SetCursorLock(CursorLockMode mode) { +#if USE_EDITOR + const auto win = Editor::Managed->GetGameWindow(); +#else + const auto win = Engine::MainWindow; +#endif + if (win && mode == CursorLockMode::Clipped) + { + win->StartClippingCursor(win->GetClientBounds()); + } + else if (win && CursorLock == CursorLockMode::Clipped) + { + win->EndClippingCursor(); + } CursorLock = mode; } diff --git a/Source/Engine/Input/Enums.h b/Source/Engine/Input/Enums.h index 9600cd2b8..6dc4b78b1 100644 --- a/Source/Engine/Input/Enums.h +++ b/Source/Engine/Input/Enums.h @@ -21,6 +21,11 @@ API_ENUM() enum class CursorLockMode /// Cursor position is locked to the center of the game window. /// Locked = 1, + + /// + /// Cursor position is confined to the bounds of the game window. + /// + Clipped = 2, }; ///