Summary
Engine-managed cursor handling with ui.set_cursor(CursorIcon) and ui.get_cursor() -> CursorIcon.
Motivation
As previously discussed in #15 directly calling set_mouse_cursor is prone to flicker due to multiple changes per frame requiring users to handle the cursor state manually.
Relying on users to track the cursor state and call set_mouse_cursor at frame end is not ergonomic.
Proposed API
ui.set_cursor(CursorIcon::Pointer);
let current: CursorIcon = ui.get_cursor();
- Remove
set_mouse_cursor from the prelude
- The cursor is set automatically during
ui.eval() (if not headless)
Behavior
- The default cursor is
CursorIcon::Pointer
ui.set_cursor(...) persists between frames and overwrites ui.get_cursor() immediately
ui.get_cursor() gives the set cursor
miniquad::window::set_mouse_cursor(ui.get_cursor()) is called in ui.eval() (if not headless)
miniquad::CursorIcon remains re-exported
Summary
Engine-managed cursor handling with
ui.set_cursor(CursorIcon)andui.get_cursor() -> CursorIcon.Motivation
As previously discussed in #15 directly calling
set_mouse_cursoris prone to flicker due to multiple changes per frame requiring users to handle the cursor state manually.Relying on users to track the cursor state and call
set_mouse_cursorat frame end is not ergonomic.Proposed API
set_mouse_cursorfrom the preludeui.eval()(if not headless)Behavior
CursorIcon::Pointerui.set_cursor(...)persists between frames and overwritesui.get_cursor()immediatelyui.get_cursor()gives the set cursorminiquad::window::set_mouse_cursor(ui.get_cursor())is called inui.eval()(if not headless)miniquad::CursorIconremains re-exported