pub struct PadBindings<A: ActionSet> { /* private fields */ }Expand description
The player-edited controller buttons: every rebindable action’s button
slots, each holding a button or a button chord (ticket
1034; a chord and its buttons on their own are different bindings).
One setup for both keyboard layouts (docs/design/controls.md,
Rebinding buttons); no button is reserved, and both sticks’ directions
count as buttons.
The pure editing API for the Key bindings screen (0816), the same shape
as LayoutBindings: bind, clear,
defaults (restore defaults),
unmapped_required.
Implementations§
Source§impl<A: ActionSet> PadBindings<A>
impl<A: ActionSet> PadBindings<A>
Sourcepub fn defaults(def: &KeymapDef<A>) -> Self
pub fn defaults(def: &KeymapDef<A>) -> Self
The default buttons from keymap.ron’s pad table, each action’s
buttons in its slots in file order.
Sourcepub fn slots(&self, action: A) -> ButtonSlots
pub fn slots(&self, action: A) -> ButtonSlots
action’s button slots (all empty for Debug, which has none).
Sourcepub fn find(
&self,
group: A::Group,
button: impl Into<ButtonChord>,
) -> Option<(A, usize)>
pub fn find( &self, group: A::Group, button: impl Into<ButtonChord>, ) -> Option<(A, usize)>
The slot of one of group’s actions holding button (a button or
a button chord), if any.
Sourcepub fn bind(
&mut self,
action: A,
i: usize,
button: impl Into<ButtonChord>,
) -> Result<Option<(A, usize)>, BindError<A>>
pub fn bind( &mut self, action: A, i: usize, button: impl Into<ButtonChord>, ) -> Result<Option<(A, usize)>, BindError<A>>
Puts button (a button or a button chord) in action’s slot i,
replacing what was there. If button was in another slot (of any
action of action’s group, including action), that slot is
emptied and returned: the button moves, which may leave that
action with no button. An action of another group keeps it.
Sourcepub fn clear(&mut self, action: A, i: usize)
pub fn clear(&mut self, action: A, i: usize)
Empties action’s slot i (nothing happens for a slot that doesn’t
exist).
Sourcepub fn is_unmapped(&self, action: A) -> bool
pub fn is_unmapped(&self, action: A) -> bool
Whether every slot of action is empty (shows ! not mapped).
Sourcepub fn unmapped_required(&self) -> Vec<A>
pub fn unmapped_required(&self) -> Vec<A>
The required actions with no button, in
ActionSet::ALL order. The Key bindings screen can’t be left while
this isn’t empty.
Sourcepub fn pairs(&self) -> impl Iterator<Item = (ButtonChord, A)> + '_
pub fn pairs(&self) -> impl Iterator<Item = (ButtonChord, A)> + '_
Every bound button and button chord with its action, for
Keymap::with_pad: in action then slot order.
Trait Implementations§
Source§impl<A: Clone + ActionSet> Clone for PadBindings<A>
impl<A: Clone + ActionSet> Clone for PadBindings<A>
Source§fn clone(&self) -> PadBindings<A>
fn clone(&self) -> PadBindings<A>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more