bevy/examples/input/keyboard_modifiers.rs
CGMossa 93a131661d Very minor doc formatting changes (#5287)
# Objective

- Added a bunch of backticks to things that should have them, like equations, abstract variable names,
- Changed all small x, y, and z to capitals X, Y, Z.

This might be more annoying than helpful; Feel free to refuse this PR.
2022-07-12 13:06:16 +00:00

23 lines
623 B
Rust

//! Demonstrates using key modifiers (ctrl, shift).
use bevy::{
input::{keyboard::KeyCode, Input},
prelude::*,
};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_system(keyboard_input_system)
.run();
}
/// This system prints when `Ctrl + Shift + A` is pressed
fn keyboard_input_system(input: Res<Input<KeyCode>>) {
let shift = input.any_pressed([KeyCode::LShift, KeyCode::RShift]);
let ctrl = input.any_pressed([KeyCode::LControl, KeyCode::RControl]);
if ctrl && shift && input.just_pressed(KeyCode::A) {
info!("Just pressed Ctrl + Shift + A!");
}
}