Add mouse capture example#614
Add mouse capture example#614eliaspekkala wants to merge 1 commit intobevyengine:masterfrom eliaspekkala:mouse-capture-example
Conversation
|
This is definitely an important feature to illustrate, but I don't consider the As you are probably aware, bevy doesn't have an "abstract" mouse capture api (which means users must use winit for it currently). Additionally our Window abstraction as it stands today isn't very dynamic. It doesn't let you set window properties on demand like you can with winit. I chose to expose WinitWindows because I acknowledge that the gaps as they stand prevent people from building useful things. But I also dont want "official learning material" to include this because it actively encourages non-future proof code. In the short term, I'm cool with tacking these properties onto the existing WindowDescriptor to unblock scenarios like this. But medium term I think we need to revisit our Window abstraction and either:
|
|
There is a very similar example in the cookbook: https://github.com/jamadazi/bevy-cookbook/blob/master/bevy-cookbook.md#grabbing-the-mouse |
|
Thanks for taking the time to write about the design considerations. I'll close this pull request, and then we can refer to it (or the cookbook) if someone wants to know how to do mouse capturing currently. Shall we create an issue for a mouse capture API and another for the window abstraction? |
|
That would be much appreciated! |
This pull request adds an example for how to capture the mouse cursor (grab it and hide it).