-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add first-party asset-based cursor icons to Bevy #9557
Comments
The first PR for this should be quite simple: just create a UI element from an image, and keep it synced with the mouse while disabling the built in cursor. Probably have a Picking-integrated reactivity can come later. |
We actually need winit support to do this correctly. Relying on the rendered window to draw a cursor is never going to have the same low latency as the OS cursor. I've noticed other games with custom cursors have properties that prove this:
Regardless, I agree an asset-based solution would be nice, but I wanted to point out we do need to use OS APIs to do this without jank. |
More proof this is possible, navigate to this page and hover over the demo to get the rainbow icon. Scroll up so the demo is at the bottom edge of the screen. You will be able to see the custom cursor image hanging outside the bounds of the browser window. Additionally, the latency is perfect. |
Definitely agree that we should hook into the OS layer. Unsure if there's a sensible way to do this with |
The winit API should just accept image bytes for the |
rust-windowing/winit#3218 has just been merged 🎉 |
Came to say the same :) Is there a tracking issue for upgrading |
#10702 just bumped the winit version to the latest release :) For the next release, whoever wants to can claim it. Just split apart the "minimal migration" from the "use new feature" for easier reviews. |
Winit maintainers said that the changes won't be released in a patch version, so we might need to wait for a while. They also want to bake the feature a little bit more. |
FYI, winit's existing
set_cursor_icon
method is inadequate for games: it only supports a fixed, unstyled list and relies on OS support. In games, you often need new options (a mining pick! an axe! a sword!), and virtually always want custom assets.This isn't something
winit
can fix, since it doesn't come with an asset / rendering solution. Instead, we should build our own cursor icon solution, with a "native" variant that just uses the OS ones provided by winit.Originally posted by @alice-i-cecile in #9538 (reply in thread)
The text was updated successfully, but these errors were encountered: