Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bevyengine
GitHub Repository: bevyengine/bevy
Path: blob/main/examples/input/keyboard_input_events.rs
6595 views
1
//! Prints out all keyboard events.
2
3
use bevy::{input::keyboard::KeyboardInput, prelude::*};
4
5
fn main() {
6
App::new()
7
.add_plugins(DefaultPlugins)
8
.add_systems(Update, print_keyboard_event_system)
9
.run();
10
}
11
12
/// This system prints out all keyboard events as they come in
13
fn print_keyboard_event_system(mut keyboard_input_events: EventReader<KeyboardInput>) {
14
for event in keyboard_input_events.read() {
15
info!("{:?}", event);
16
}
17
}
18
19