pub struct InputMap { /* private fields */ }Expand description
Action / binding map. One per engine — registered as a service in the
ServiceRegistry and updated once per frame from the input queue.
Implementations§
Source§impl InputMap
impl InputMap
Sourcepub fn bind(&mut self, action: impl Into<Action>, binding: InputBinding)
pub fn bind(&mut self, action: impl Into<Action>, binding: InputBinding)
Adds a binding for action. An action can have multiple bindings —
it fires when ANY of them fires (logical OR).
Sourcepub fn unbind(&mut self, action: &Action, binding: &InputBinding) -> bool
pub fn unbind(&mut self, action: &Action, binding: &InputBinding) -> bool
Removes a single binding for action. Returns true if found.
Sourcepub fn clear_action(&mut self, action: &Action)
pub fn clear_action(&mut self, action: &Action)
Removes every binding for action.
Sourcepub fn is_pressed(&self, action: &str) -> bool
pub fn is_pressed(&self, action: &str) -> bool
Returns true when the named action is currently held.
Sourcepub fn just_pressed(&self, action: &str) -> bool
pub fn just_pressed(&self, action: &str) -> bool
Returns true only on the frame the action transitioned from
released → pressed. Cleared on the next update call.
Sourcepub fn just_released(&self, action: &str) -> bool
pub fn just_released(&self, action: &str) -> bool
Returns true only on the frame the action transitioned from
pressed → released. Cleared on the next update call.
Sourcepub fn update(&mut self, events: &[InputEvent])
pub fn update(&mut self, events: &[InputEvent])
Drains a frame of input events into the action sets. Call once per
frame before game logic queries the map. Edge sets (just_*)
are cleared first; held set persists across frames until a Released
event arrives.