Added FocusedWindow event and raw winit WindowEvents#956
Added FocusedWindow event and raw winit WindowEvents#956cart merged 1 commit intobevyengine:masterfrom thebluefish:winit_window_events
Conversation
crates/bevy_window/src/event.rs
Outdated
|
|
||
| /// An event that indicates a window has received or lost focus. | ||
| #[derive(Debug, Clone)] | ||
| pub struct FocusedWindow { |
There was a problem hiding this comment.
Since it can be focused or unfocused, maybe a different name may be valuable. Something like WindowFocus or FocusChanged?
There was a problem hiding this comment.
I'm starting to think that we shouldn't expose winit events directly. The whole point of bevy_window / bevy_input is to make user-facing code backend-agnostic. If we add console support in the future, it likely won't go through winit, which means user-facing code directly referencing winit events will break. Or in the future if we decide to replace winit with something else, that would be a breaking change.
Edit: the rationale for exposing winit events was that it "filled in the gaps" while bevy_window is fleshed out. But if we use winit events to fill in the gaps, that allows people to do what they want "the hackey way" and reduces the desire/need to expose things "the right way".
crates/bevy_window/src/event.rs
Outdated
|
|
||
| /// An event that indicates a window has received or lost focus. | ||
| #[derive(Debug, Clone)] | ||
| pub struct FocusedWindow { |
|
I removed the winit events, renamed to |
Also adds a new example demonstrating how to use both.