Skip to content

Commit

Permalink
Added cursor shape updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Adham084 committed Apr 1, 2023
1 parent 51748f8 commit eb5d335
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions MonoGame.ImGui/Data/InputData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,27 @@ public void Update(Game game) {
var scrollDelta = mouse.ScrollWheelValue - Scrollwheel;
io.MouseWheel = scrollDelta > 0 ? 1 : scrollDelta < 0 ? -1 : 0;
Scrollwheel = mouse.ScrollWheelValue;

UpdateCursor();
}

private void UpdateCursor() {
MouseCursor mouseCursor = ImGui.GetMouseCursor() switch {
ImGuiMouseCursor.None => MouseCursor.Arrow,
ImGuiMouseCursor.Arrow => MouseCursor.Arrow,
ImGuiMouseCursor.TextInput => MouseCursor.IBeam,
ImGuiMouseCursor.ResizeAll => MouseCursor.SizeAll,
ImGuiMouseCursor.ResizeNS => MouseCursor.SizeNS,
ImGuiMouseCursor.ResizeEW => MouseCursor.SizeWE,
ImGuiMouseCursor.ResizeNESW => MouseCursor.SizeNESW,
ImGuiMouseCursor.ResizeNWSE => MouseCursor.SizeNWSE,
ImGuiMouseCursor.Hand => MouseCursor.Hand,
ImGuiMouseCursor.NotAllowed => MouseCursor.No,
ImGuiMouseCursor.COUNT => MouseCursor.Wait,
_ => throw new ArgumentOutOfRangeException()
};

Mouse.PlatformSetCursor(mouseCursor);
}

public InputData Initialize(Game game) {
Expand Down

0 comments on commit eb5d335

Please sign in to comment.