Skip to main content

Module profiles

Module profiles 

Source
Expand description

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

Confirm on a profile opens what can be done to it (ProfileAction): use it, rename it, delete it (asking first, focus on No; never the only profile). Adding asks for a name and uses the new profile; it starts from the default options. Then the screen closes, or opens what the game gives (ProfilesScreen::opening_after_add: its first-launch setup, say). A name is typed on the keyboard or spelled on the letter grid with a controller (crate::widgets::name_entry), up to MAX_NAME_CHARS, not another profile’s. Cancel in a name box with a name typed and not kept asks whether to keep it, throw it away or go back, focus on going back.

The look is a skin. This module says what the screen shows as a ProfilesView (ProfilesScreen::view); glyph::paint draws it, unless the game gives another painter (ProfilesScreen::painted_by). Tests of what happened read the view or the profiles.

Re-exports§

pub use view::ActionsView;
pub use view::ProfilesView;
pub use view::RowView;

Modules§

glyph
The glyph look of the profiles screen: a panel with the profiles, the one in use marked, then the row that adds one (in the style of the options screen); the menu of what can be done to a profile, the name boxes and the questions in double-bordered boxes over it. Everything about the look lives here; nothing here decides what the screen shows. Another look is another paint of the same view (ProfilesScreen::painted_by).
view
What the profiles screen shows, as plain data: no cells, glyphs, colours or positions. The screen builds a ProfilesView each frame (ProfilesScreen::view) and a skin paints it (super::glyph::paint today).

Structs§

ProfilesScreen
The profiles, the one in use marked, and a row to add one. Cancel closes it.

Enums§

DeleteChoice
An answer to the question asked before deleting.
NamePurpose
What a name box is for.
ProfileAction
What can be done to a profile.
RowKind
One row of the screen.

Constants§

ADD
Text key of the row that adds a profile.
CURRENT
Text key of the words marking the profile in use.
DELETE_QUESTION
Text key of the question asked before deleting, with {name}.
HELP_ACTIONS
Text key of the help line while a profile’s actions are open.
HELP_ADD
Text key of the help line on the row that adds one.
HELP_LIST
Text key of the help line on a profile.
HELP_NONE
Text key of the help line on the row that adds one, with the most profiles already.
HELP_QUESTION
Text key of the help line while a question is open.
KEEP_QUESTION
Text key of the question asked on backing out of a name box.
NAME_BOX
Text key of the name box’s title.
NAME_RULES
What a profile’s name may hold: letters and digits (the engine names a profile Player 2), up to MAX_NAME_CHARS.
NAME_TAKEN_MESSAGE
Text key of the message when the name is another profile’s.
NOT_SAVED_MESSAGE
Text key of the message if the profiles couldn’t be saved.
TITLE
Text key (Ctx::text) of the screen title.
TOO_MANY_MESSAGE
Text key of the message when there are the most profiles already, with {n}.

Type Aliases§

AfterAdd
What opens once a profile is added and in use, in the screen’s place (ProfilesScreen::opening_after_add).
Paint
What paints the screen’s view: glyph::paint, or the game’s own (ProfilesScreen::painted_by).