Skip to main content

HelpKeys

Struct HelpKeys 

Source
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>

Source

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).

Source

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.

Source

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.

Source

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).

Source

pub fn on_keyboard(self) -> Self

These bindings’ keyboard keys, whatever the player is using.

Source

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).

Source

pub fn keyboard(keymap: &'a Keymap<A>) -> Self

keymap’s keyboard keys, whatever the player is using (a picture of the keyboard, a keyboard-only key).

Source

pub fn device(self) -> Device

The device whose keys or buttons are named.

Methods from Deref<Target = Keymap<A>>§

Source

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.

Source

pub fn action(&self, chord: Chord) -> Option<A>

The first of actions, if any: the only one for a chord of a single group.

Source

pub fn pad_actions(&self, button: Button) -> &[A]

The actions bound to the controller button button on its own, as actions.

Source

pub fn pad_action(&self, button: Button) -> Option<A>

The first of pad_actions, if any.

Source

pub fn chord_actions(&self, chord: ButtonChord) -> &[A]

The actions bound to chord (a button chord, or one button), as actions.

Source

pub fn buttons_for(&self, action: A) -> Vec<ButtonChord>

Every controller button and button chord bound to action, in the order they were given (file order for the keymap file).

Source

pub fn repeat(&self) -> RepeatDef

Key-repeat timings.

Source

pub fn chord(&self) -> ChordDef

Button chords’ timing.

Source

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.

Source

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).

Source

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.

Source

pub fn cursor_buttons_name(&self, kind: PadKind) -> Option<String>

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.

Source

pub fn primary_button(&self, action: A) -> Option<ButtonChord>

The button (or button chord) help text names for action: the first of buttons_for, or None if it has none.

Source

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.

Source

pub fn has_input(&self, action: A, device: Device) -> bool

Whether action has a key (keyboard) or a button (pad) for device.

Trait Implementations§

Source§

impl<'a, A: Clone + ActionSet> Clone for HelpKeys<'a, A>

Source§

fn clone(&self) -> HelpKeys<'a, A>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, A: Copy + ActionSet> Copy for HelpKeys<'a, A>

Source§

impl<'a, A: Debug + ActionSet> Debug for HelpKeys<'a, A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A: ActionSet> Deref for HelpKeys<'_, A>

Source§

type Target = Keymap<A>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Keymap<A>

Dereferences the value.
Source§

impl<'a, A: Eq + ActionSet> Eq for HelpKeys<'a, A>

Source§

impl<'a, A: PartialEq + ActionSet> PartialEq for HelpKeys<'a, A>

Source§

fn eq(&self, other: &HelpKeys<'a, A>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a, A: PartialEq + ActionSet> StructuralPartialEq for HelpKeys<'a, A>

Auto Trait Implementations§

§

impl<'a, A> Freeze for HelpKeys<'a, A>

§

impl<'a, A> RefUnwindSafe for HelpKeys<'a, A>
where A: RefUnwindSafe,

§

impl<'a, A> Send for HelpKeys<'a, A>
where A: Sync,

§

impl<'a, A> Sync for HelpKeys<'a, A>
where A: Sync,

§

impl<'a, A> Unpin for HelpKeys<'a, A>

§

impl<'a, A> UnsafeUnpin for HelpKeys<'a, A>

§

impl<'a, A> UnwindSafe for HelpKeys<'a, A>
where A: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.