Relative mouse pos

This commit is contained in:
teinarss
2019-06-09 20:34:37 +02:00
committed by abcdefg30
parent d7643602c1
commit f325a4d190
3 changed files with 16 additions and 10 deletions

View File

@@ -138,15 +138,13 @@ namespace OpenRA.Graphics
void Update()
{
if (cursor == null)
if (cursor != null && frame >= cursor.Length)
frame %= cursor.Length;
if (cursor == null || isLocked)
Game.Renderer.Window.SetHardwareCursor(null);
else
{
if (frame >= cursor.Length)
frame = frame % cursor.Length;
Game.Renderer.Window.SetHardwareCursor(hardwareCursors[cursor.Name][frame]);
}
}
public void Render(Renderer renderer)
@@ -171,12 +169,14 @@ namespace OpenRA.Graphics
lockedPosition = Viewport.LastMousePos;
Game.Renderer.Window.SetRelativeMouseMode(true);
isLocked = true;
Update();
}
public void Unlock()
{
Game.Renderer.Window.SetRelativeMouseMode(false);
isLocked = false;
Update();
}
public void Dispose()