Expand description
The Key bindings screen: every action of the game’s rows
(KeyRow) with its SLOTS key slots for the layout in use, or, on
its controller Side, its SLOTS button slots. A row at the top switches between
the two. Confirm on a slot captures the next key or button pressed into
it; one taken from another slot moves; leaving is blocked while a
required action has no key or no button; Restore defaults asks first.
The screen edits a copy of the layout’s LayoutBindings and of the
PadBindings and hands them to Ctx when it closes, so it is steered
with the keys and buttons the player had when they opened it: moving
every cursor key elsewhere can’t trap them here.
No controller button is fixed, so the screen works with only a
controller: a button goes in the slot when it is let go, holding any
button backs out of a capture, and when the controller was used last
Confirm on a slot offers CHOICES (change it or clear it). A second
button pressed while the first is held makes the slot a button chord
of the two (ticket 1045, game ADR-0079). A button of the capture still held
when it ends does nothing when let go: on a pad whose buttons act when
let go (the Playdate’s B), it would otherwise back out of the screen.
On a platform with no keyboard (Keyboard::Absent, the Playdate) the
screen shows the controller side alone: no switch, and leaving asks
only that every required action has a button.
Capture is the one place that reads raw key presses
(FrameInput::pressed_chords) and raw button presses
(FrameInput::pressed_buttons); which keys back out or clear a slot is
asked of input (is_capture_abort, is_clear_slot), and a
button’s name of PadKind::button_name, never named here.
The look is a skin. This module decides what the screen
shows and does, and says it as plain data: a KeyBindingsView
(KeyBindingsScreen::view). glyph::paint draws that view as
glyphs, unless the game gives another painter
(KeyBindingsScreen::painted_by). Tests of what happened read the
view; only the painters’ tests read cells.
Re-exports§
pub use view::ChoicesView;pub use view::GroupView;pub use view::KeyBindingsView;pub use view::RestoreView;pub use view::RowView;pub use view::SlotView;pub use view::SwitchView;
Modules§
- glyph
- The glyph look of the Key bindings screen: paints a
KeyBindingsViewas a panel of text rows, a column per slot, with the focused slot as a bar. Everything about the look lives here (where things go, the box characters, the colours); nothing here decides what the screen shows or does. Another look is anotherpaintof the same view. - view
- What the Key bindings screen shows, as plain data: no cells, glyphs,
colours or positions. The screen builds a
KeyBindingsVieweach frame (KeyBindingsScreen::view) and a skin paints it (super::glyph::painttoday).
Structs§
- KeyBindings
Screen - The Key bindings screen for one layout and the controller. Cancel saves and closes it, unless a required action has no key or no button.
Enums§
- RowGroup
- What a row of the Key bindings screen sits under.
- Side
- Which bindings the screen shows and edits.
Constants§
- CAPTURE_
BUTTON_ PROMPT - The text key of what a slot shows while it waits for a controller button.
- CAPTURE_
HELP - Text key of the help while a slot waits for a key.
- CAPTURE_
PROMPT - The text key of what a slot shows while it waits for a key.
- CHOICES
- Text keys of what Confirm on a slot offers when the controller was used last: put another key or button in it, or empty it.
- CONTROLLER_
SIDE - Text key of the switch row’s name for the controller side.
- HOLD_
TO_ CANCEL - Text key of the help for backing out of a capture with only a controller.
- HOLD_
TO_ CANCEL_ SECS - How long a controller button is held to back out of a capture, in seconds (tunable). Let go sooner, it goes in the slot.
- KEYBOARD_
SIDE - Text key of the switch row’s name for the keyboard side, which the layout’s name follows.
- MOVED_
FLASH_ SECS - How long the row that just lost its key to another slot stays highlighted, in seconds (tunable).
- OPTIONAL_
HEADING - Text key of the heading over the optional actions.
- REQUIRED_
BUTTON_ HEADING - Text key of the heading over the required actions, on the controller side.
- REQUIRED_
HEADING - Text key of the heading over the required actions, on the keyboard side.
- RESERVED_
MESSAGE - Text key of what shows when the key pressed for a slot is reserved.
- RESTORE_
DEFAULTS - Text key of the row under the actions that puts the shown side’s defaults back.
- TITLE
- Text key of the screen’s title.
Functions§
- blocked_
message - The blocked-leave message for
actiononside(Give Cancel a key first,Give Cancel a button first). - label
- The player-facing name of
action(its row’s label) inctx’s language; its keymap name for an action not on the screen (Debug).
Type Aliases§
- KeyRow
- One row of the Key bindings screen, as the game gives it: the action,
the text key of its player-facing label (
Unit info) and what it sits under. Rows of one group come together, in the order the screen lists them. - Paint
- What paints the screen’s view:
glyph::paint, or the game’s own (KeyBindingsScreen::painted_by).