2022-05-16 13:53:20 +00:00
|
|
|
//! Prints out all keyboard events.
|
|
|
|
|
2020-06-05 06:49:36 +00:00
|
|
|
use bevy::{input::keyboard::KeyboardInput, prelude::*};
|
|
|
|
|
|
|
|
fn main() {
|
2021-07-27 20:21:06 +00:00
|
|
|
App::new()
|
2020-11-03 03:01:17 +00:00
|
|
|
.add_plugins(DefaultPlugins)
|
2021-07-27 23:42:36 +00:00
|
|
|
.add_system(print_keyboard_event_system)
|
2020-06-05 06:49:36 +00:00
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
2020-08-12 16:13:32 +00:00
|
|
|
/// This system prints out all keyboard events as they come in
|
2021-01-19 06:23:30 +00:00
|
|
|
fn print_keyboard_event_system(mut keyboard_input_events: EventReader<KeyboardInput>) {
|
|
|
|
for event in keyboard_input_events.iter() {
|
2021-04-22 23:30:48 +00:00
|
|
|
info!("{:?}", event);
|
2020-06-05 06:49:36 +00:00
|
|
|
}
|
|
|
|
}
|