mirror of
https://github.com/bevyengine/bevy.git
synced 2026-06-30 15:55:32 -04:00
4d74baf1ae
This renames the concept of `BufferedEvent` to `Message`, and updates our APIs, comments, and documentation to refer to these types as "messages" instead of "events". It also removes/updates anything that considers messages to be "observable", "listenable", or "triggerable". This is a followup to https://github.com/bevyengine/bevy/pull/20731, which omitted the `BufferedEvent -> Message` rename for brevity. See that post for rationale.
18 lines
480 B
Rust
18 lines
480 B
Rust
//! Prints out all keyboard events.
|
|
|
|
use bevy::{input::keyboard::KeyboardInput, prelude::*};
|
|
|
|
fn main() {
|
|
App::new()
|
|
.add_plugins(DefaultPlugins)
|
|
.add_systems(Update, print_keyboard_event_system)
|
|
.run();
|
|
}
|
|
|
|
/// This system prints out all keyboard inputs as they come in
|
|
fn print_keyboard_event_system(mut keyboard_inputs: MessageReader<KeyboardInput>) {
|
|
for keyboard_input in keyboard_inputs.read() {
|
|
info!("{:?}", keyboard_input);
|
|
}
|
|
}
|