Skip to content

Expose a CursorPosition resource #5034

@alice-i-cecile

Description

@alice-i-cecile

What problem does this solve or what need does it fill?

Knowing where your mouse is is useful and should be ergonomic.

What solution would you like?

Store and update a CursorPosition resource, which reads from the Window resource to store an Option<Vec2> representing the physical position of the mouse (or other cursor).

What alternative(s) have you considered?

Compute this manually every time it's needed.

Additional context

This will be impacted by #4530, which will move where this data is stored.

Better APIs to convert between world space and screen space coordinates will make this functionality even more useful; we should add methods on MousePosition to do this once those are established.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-InputPlayer input via keyboard, mouse, gamepad, and moreC-UsabilityA targeted quality-of-life change that makes Bevy easier to use

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions