bevy/examples/input/keyboard_input_events.rs

18 lines
472 B
Rust
Raw Normal View History

//! Prints out all keyboard events.
2020-06-05 06:49:36 +00:00
use bevy::{input::keyboard::KeyboardInput, prelude::*};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Update, 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
}
}