Skip to content

Cursor ergonomics #68

@TheRedDeveloper

Description

@TheRedDeveloper

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    approvedA feature that has been approvedfeatNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions