Skip to main content

Module screens

Module screens 

Source
Expand description

Screens any game can use, each with rows, entries or a legend the game gives: the layout_picker, the key_bindings screen, the options screen and the player profiles screen. Each says what it shows as plain data (a view) and a skin paints it (glyph for glyphs).

Re-exports§

pub use crate::frame::draw::cut;

Modules§

key_bindings
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.
layout_picker
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).
options
An options screen: the player’s settings one per row, changed with the cursor’s left and right keys, and rows that do something (open a screen, ask a question). The game gives the rows (OptionRow), each a label key and a typed value: on or off (RowValue::Toggle), one of several (RowValue::Choice), a volume (RowValue::Volume), or something Confirm does (RowValue::Action). The engine’s own settings come as rows ready made (OptionRow::text_speed, OptionRow::fullscreen, OptionRow::frame_cap, the volumes, OptionRow::restore_defaults).
profiles
A player profiles screen: the profiles, the one in use marked, then a row that adds one. It lets the people who share a computer each keep their own settings and saves under a name, on the Ctx profile functions (Ctx::add_profile and the rest).

Constants§

TEXT_BOX_HELP
The text key of a text box’s help line, with {done}, {delete} and {cancel}: the text box’s fixed keys.

Functions§

centre_x
Column at which width cells are centred in buf (rounded left).
print_centred
Prints text centred on row y. A text wider than buf starts at column 0, cut to the buffer’s width.
text_keys_help
The help line of a text box: Enter done · Backspace delete · Escape cancel, in ctx’s language.