bevy/crates/bevy_window/src/system.rs

13 lines
377 B
Rust
Raw Normal View History

2020-07-10 04:18:35 +00:00
use crate::WindowCloseRequested;
use bevy_app::AppExit;
use bevy_ecs::event::{EventReader, EventWriter};
2020-07-10 04:18:35 +00:00
pub fn exit_on_window_close_system(
mut app_exit_events: EventWriter<AppExit>,
mut window_close_requested_events: EventReader<WindowCloseRequested>,
2020-07-10 04:18:35 +00:00
) {
if window_close_requested_events.iter().next().is_some() {
2020-07-10 04:18:35 +00:00
app_exit_events.send(AppExit);
}
2020-04-25 01:55:15 +00:00
}