Skip to main content

Module layout_picker

Module layout_picker 

Source
Expand description

The first-launch “Pick your layout” screen: one panel per Layout the keymap file lists, with a small keyboard diagram and a legend, both read from that layout’s bindings. A game’s options open it again to switch layout (LayoutPickerScreen::change). What the legend lists is the game’s (Legend).

The look is a skin. This module decides what the screen shows and does, and says it as plain data: a LayoutPickerView (LayoutPickerScreen::view), with each layout’s legend and what each key of its keyboard does. glyph::paint draws that view as glyphs and decides where the keys sit. Tests of what happened read the view; only glyph’s tests read cells.

Re-exports§

pub use view::KeyCapView;
pub use view::KeyRole;
pub use view::LayoutPickerView;
pub use view::LayoutView;
pub use view::LegendRow;

Modules§

glyph
The glyph look of the layout picker: paints a LayoutPickerView as one panel per layout, each with a small keyboard (the keys’ places are this skin’s) and a legend. Everything about the look lives here; nothing here decides what the screen shows. Another look is another paint of the same view.
view
What the layout picker shows, as plain data: no cells, glyphs, colours or positions. The screen builds a LayoutPickerView each frame (LayoutPickerScreen::view) and a skin paints it (super::glyph::paint today).

Structs§

LayoutPickerScreen
Shows every layout and saves the one picked. Asked for by a key press while no layout is chosen, it can’t be cancelled with a key (the keyboard needs a layout), but any controller button closes it without choosing: that player is on the controller. Pops itself once a layout is picked.

Enums§

LegendKeys
Which keys a line of the legend names.

Constants§

HELP_CHANGE
The text key of the help line when the picker is opened to switch layout (it names the Cancel key too).
HELP_FIRST
The text key of the help line the first time, before any layout is chosen, with {up}, {down} and {confirm}: every key of each.
TITLE
The key of the title in the language files (Ctx::text).

Functions§

label
The name shown for a layout, in ctx’s language: the text key the keymap file gives it (empty for a layout the keymap doesn’t have, which is never in use).

Type Aliases§

Legend
The game’s legend, top to bottom: which keys each line names, and the text key of what they do.