Skip to content
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 setting a mouse position #9

Open
richelbilderbeek opened this issue Nov 25, 2024 · 1 comment
Open

Add setting a mouse position #9

richelbilderbeek opened this issue Nov 25, 2024 · 1 comment

Comments

@richelbilderbeek
Copy link
Owner

richelbilderbeek commented Nov 25, 2024

I thought it was impossible, until I posted to the Bevy Discord:

For testing, I need to put the mouse cursor to a specific position. I've searched the Rust doc, internet and Discord channel, and the closest I got is:

app.world_mut().send_event(bevy::input::mouse::MouseMotion {
    delta: Vec2::new(100.0, 100.0),
});

This is a relative mouse movement. However, I want to set it to an absolute position. I cannot imagine that relative movement of the mouse cursors is implemented and absolute is not.

How to set the mouse cursor to a specific position?

Thanks and cheers, Richel

Then faervan answered:

Have you tried Window::set_cursor_position() ?

Add it to the book 👍

@richelbilderbeek
Copy link
Owner Author

Added faervan already to the contributors 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant