pub struct ActionMap { /* private fields */ }Expand description
Declarative multi-key and pointer-button binding table mapping physical inputs to GameActions.
Implementations§
Source§impl ActionMap
Binding registration and real-time input queries for ActionMap.
impl ActionMap
Binding registration and real-time input queries for ActionMap.
Sourcepub fn bind_key(&mut self, action: GameAction, key: KeyCode)
pub fn bind_key(&mut self, action: GameAction, key: KeyCode)
Binds a KeyCode to action.
§Arguments
&Self- Mutable action map.GameAction- Semantic game action.KeyCode- Keyboard key to bind.
Binds a PointerButton to action.
§Arguments
&Self- Mutable action map.GameAction- Semantic game action.PointerButton- Mouse/touch button to bind.
Sourcepub fn is_active(&self, action: GameAction, input: &InputState) -> bool
pub fn is_active(&self, action: GameAction, input: &InputState) -> bool
Sourcepub fn is_just_pressed(&self, action: GameAction, input: &InputState) -> bool
pub fn is_just_pressed(&self, action: GameAction, input: &InputState) -> bool
Sourcepub fn movement_vector(&self, input: &InputState) -> Point
pub fn movement_vector(&self, input: &InputState) -> Point
Source§impl ActionMap
impl ActionMap
pub fn get_key_bindings(&self) -> &HashMap<GameAction, Vec<KeyCode>>
pub fn get_mut_key_bindings(&mut self) -> &mut HashMap<GameAction, Vec<KeyCode>>
pub fn set_key_bindings( &mut self, val: HashMap<GameAction, Vec<KeyCode>>, ) -> &mut Self
Trait Implementations§
Auto Trait Implementations§
impl Forget for ActionMap
impl Freeze for ActionMap
impl Move for ActionMap
impl RefUnwindSafe for ActionMap
impl Send for ActionMap
impl Sync for ActionMap
impl Unpin for ActionMap
impl UnsafeUnpin for ActionMap
impl UnwindSafe for ActionMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more