Files
rapier/src_testbed/testbed/keys.rs
Sébastien Crozet 0b7c3b34ec feat: migrate to glam whenever relevant + migrate testbed to kiss3d instead of bevy + release v0.32.0 (#909)
* feat: migrate to glam whenever relevant + migrate testbed to kiss3d instead of bevy

* chore: update changelog

* Fix warnings and tests

* Release v0.32.0
2026-01-09 17:26:36 +01:00

25 lines
505 B
Rust

//! Keyboard state tracking.
use kiss3d::event::Key;
/// Keyboard state
#[derive(Default, Clone, Debug)]
pub struct KeysState {
pub shift: bool,
pub ctrl: bool,
pub alt: bool,
pub pressed_keys: Vec<Key>,
}
impl KeysState {
/// Check if a specific key is currently pressed
pub fn pressed(&self, key: Key) -> bool {
self.pressed_keys.contains(&key)
}
/// Get all currently pressed keys
pub fn get_pressed(&self) -> &[Key] {
&self.pressed_keys
}
}