add CursorLockMode.Clipped
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,11 @@ API_ENUM() enum class CursorLockMode
|
||||
/// Cursor position is locked to the center of the game window.
|
||||
/// </summary>
|
||||
Locked = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Cursor position is confined to the bounds of the game window.
|
||||
/// </summary>
|
||||
Clipped = 2,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user