pub struct HelpKeys<'a, A: ActionSet> { /* private fields */ }Expand description
What help text names keys from: the bindings, the device whose keys
or buttons to name, the two words a key’s name can be
(! not mapped, arrows) and what joins a button chord’s two buttons
(A+B). A game gives its screens one with the words
in the player’s language (worded). Dereferences to the
Keymap.
Implementations§
Source§impl<'a, A: ActionSet> HelpKeys<'a, A>
impl<'a, A: ActionSet> HelpKeys<'a, A>
Sourcepub fn new(keymap: &'a Keymap<A>, device: Device) -> Self
pub fn new(keymap: &'a Keymap<A>, device: Device) -> Self
keymap’s keys, or its buttons as a pad names them, by device,
with the English words (NOT_MAPPED, ARROWS).
Sourcepub fn worded(self, not_mapped: &'a str, arrows: &'a str) -> Self
pub fn worded(self, not_mapped: &'a str, arrows: &'a str) -> Self
These keys, named with not_mapped for an action with no key and
arrows for the four arrow keys: the player’s language’s words.
Sourcepub fn chord_joined(self, join: &'a str) -> Self
pub fn chord_joined(self, join: &'a str) -> Self
These keys, with join between a button chord’s two buttons
(A+B): the player’s language’s word.
Sourcepub fn of(self, keymap: &'a Keymap<A>) -> Self
pub fn of(self, keymap: &'a Keymap<A>) -> Self
These words for another set of bindings (a screen showing a keymap that isn’t the active one).
Sourcepub fn on_keyboard(self) -> Self
pub fn on_keyboard(self) -> Self
These bindings’ keyboard keys, whatever the player is using.
Sourcepub fn not_mapped(self) -> &'a str
pub fn not_mapped(self) -> &'a str
What is shown for an action with no key, or no button on a
controller (docs/design/controls.md, Rebinding keys).
Methods from Deref<Target = Keymap<A>>§
Sourcepub fn actions(&self, chord: Chord) -> &[A]
pub fn actions(&self, chord: Chord) -> &[A]
The actions bound to chord, one at most of each group, in group
order. Shift+h and h are distinct: there is no fallback from a
shifted chord to the plain one.
Sourcepub fn action(&self, chord: Chord) -> Option<A>
pub fn action(&self, chord: Chord) -> Option<A>
The first of actions, if any: the only one for a
chord of a single group.
Sourcepub fn pad_actions(&self, button: Button) -> &[A]
pub fn pad_actions(&self, button: Button) -> &[A]
The actions bound to the controller button button on its own, as
actions.
Sourcepub fn pad_action(&self, button: Button) -> Option<A>
pub fn pad_action(&self, button: Button) -> Option<A>
The first of pad_actions, if any.
Sourcepub fn chord_actions(&self, chord: ButtonChord) -> &[A]
pub fn chord_actions(&self, chord: ButtonChord) -> &[A]
The actions bound to chord (a button chord, or one button), as
actions.
Every controller button and button chord bound to action, in the
order they were given (file order for the keymap file).
Sourcepub fn chord_wait(&self, button: Button) -> ChordWait
pub fn chord_wait(&self, button: Button) -> ChordWait
How long button holds back its own actions when pressed, so that
a button chord with it can fire instead (ticket
1034). A button in no chord, or whose own action
repeats (the D-pad on the cursor), acts
on press. Otherwise it waits until it is let go if a partner of its
acts on press (B in B+←: hold it as long as you like before ←)
or it has no action of its own; else for the chord window or its
release, whichever is first (A in A+B). A pad with no chords
acts on press throughout, exactly as before chords.
Sourcepub fn chords_for(&self, action: A) -> Vec<Chord>
pub fn chords_for(&self, action: A) -> Vec<Chord>
Every chord bound to action (its key slots), in the order they
were given: slot order for the player’s bindings, file order for
the keymap file. Leaves out the fixed keys (see
fixed_chords_for).
Sourcepub fn cursor_keys_name(&self, arrows_name: &str) -> Option<String>
pub fn cursor_keys_name(&self, arrows_name: &str) -> Option<String>
What moves the cursor, for help text: arrows (the language’s word
for them) when the primary chords of the actions the game takes for
up, left, down and right are the plain arrow keys,
otherwise those chords in up-left-down-right order (wasd). None
if any of them is unbound, or the game has no such action. Lives
here, not with the help text, because it names keys.
What moves the cursor on a pad of kind, for help text: the whole
sets of direction buttons the four cursor actions are on, joined
with / (D-pad/L-stick with this game’s defaults); if they are on
no whole set, each one’s primary_button’s
name in up-left-down-right order. None if any cursor action has no
button.
The button (or button chord) help text names for action: the
first of buttons_for, or None if it has
none.
Sourcepub fn primary(&self, action: A) -> Option<Chord>
pub fn primary(&self, action: A) -> Option<Chord>
The chord help text names for action: the first of
chords_for, or None if it has none.