bevy/examples/input/keyboard_input_events.rs

16 lines
426 B
Rust
Raw Normal View History

2020-06-05 06:49:36 +00:00
use bevy::{input::keyboard::KeyboardInput, prelude::*};
fn main() {
2021-04-11 20:13:07 +00:00
App::new()
.add_plugins(DefaultPlugins)
.add_system(print_keyboard_event_system)
2020-06-05 06:49:36 +00:00
.run();
}
/// This system prints out all keyboard events as they come in
fn print_keyboard_event_system(mut keyboard_input_events: EventReader<KeyboardInput>) {
for event in keyboard_input_events.iter() {
info!("{:?}", event);
2020-06-05 06:49:36 +00:00
}
}