Skip to main content

Module ui

Module ui 

Source
Expand description

The engine’s reserved ui context: the navigation actions every UI screen is driven by, as the reserved ui_* table in docs/notes/tooling.md (What the deleted 07-ui-debug plan left behind) defines them.

ActionKindKeyboardGamepadRepeat
MOVEAxis2the arrows, and W, A, S and Dthe left stick, and the d-padRepeat::UI
NEXTButtonTabthe right shoulderRepeat::UI
PREVButtonShift+Tabthe left shoulderRepeat::UI
ACCEPTButtonEnter, SpacePadButton::Southnone
BACKButtonEscapePadButton::Eastnone
MENUButtonthe menu key, Shift+F10nonenone

Rebindable like every action — they are ordinary actions in an ordinary context, so ActionMap::rebind moves them.

Pushed only while a UI has input. Declaring the context leaves it off the stack; whoever owns a UI’s input pushes CONTEXT while that UI has it and pops it after, and while it is pushed the arrows, WASD, Tab, Enter, Space and Escape — and the pad’s left stick, d-pad, shoulders, South and East — are the UI’s and not the game’s beneath: the context stack is the disambiguator, not a list of special cases.

The stick reads through STICK_DEADZONE, so a stick resting off centre does not walk a list. The d-pad is a Binding::PadDpad, the pad’s Binding::Wasd, so it shares one unit disc with the stick and the keys.

Start is not in the table. Like Escape’s pause, it is the engine loop’s, and the loop binds it outside this context.

MENU has no pad binding. It opens a context menu, which a pad reaches through no convention every platform shares; and a pad button bound here is one a pushed context takes from the game beneath.

Constants§

ACCEPT
Fire a button, engage a widget, or commit the engaged one.
ACTIONS
Every reserved action, in the table’s order.
BACK
Cancel the engaged widget, or close the screen.
CONTEXT
The reserved context’s name.
MENU
Open the focused widget’s context menu: the keyboard’s menu key, and Shift+F10 for a keyboard without one — Windows’ pair.
MOVE
Spatial focus movement: an Axis2, +Y up.
NEXT
Forward in tree order.
PREV
Backward in tree order.
STICK_DEADZONE
The dead zone MOVE’s left stick reads through: the pad’s own activity threshold, so the stick navigates exactly when it would also make the pad the last device.

Functions§

declare
Declare the reserved ui context into map, off the stack, with Repeat::UI on the three navigation actions.