blob: 2626ec6d78a670040b94a05cd799b2cde7cf3af8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
use bevy::prelude::*;
use crate::input::events::TerminalInputEvent;
use super::components::Widget;
/// Invokes every enabled widget's `handle_events` methods for each incoming input event
pub fn widget_input_handling(
mut widgets: Query<&mut Widget>,
mut event_reader: EventReader<TerminalInputEvent>,
mut commands: Commands,
) {
for event in event_reader.read() {
for mut widget in widgets.iter_mut().filter(|widget| widget.enabled) {
widget.widget.handle_events(event, &mut commands);
}
}
}
|