Skip to content

settings_box

Anthony Samms edited this page Jun 2, 2026 · 1 revision

A SettingsBox is a single category tile on the settings screen — for example "General", "Audio", or "Video". Each box holds a label and a list of option_box, one per configurable setting in that category. Boxes slide vertically as the player navigates between them.

SettingsBox

SettingsBox(const json& box_data);

Parses a single box entry from settings_template.json. Constructs the appropriate option_box subclass for each option listed in the entry and stores them in options.

Members

Member Type Description
label OutlinedText Localised category name drawn on the tile
options vector<unique_ptr<BaseOptionBox>> All configurable options belonging to this category
selected_option int Index of the currently highlighted option within this box
in_box bool Whether the player is currently browsing this box's options
y float Current vertical screen position
target_y float Position the slide animation is easing toward

Navigation

void move_left();
void move_right();

Forwards the directional input to the active option_box, changing its value.

void next_option();
void prev_option();

Moves the selection to the next or previous option within the box. Options do not wrap.

Position

void set_y(float y);

Immediately sets both y and target_y with no animation.

void slide_to(float target_y);

Sets target_y and plays the slide animation. Y positions are clamped between −50 and 650 px so off-screen boxes are not drawn unnecessarily.

Draw

void draw();

Renders in the following order:

  1. BOX::BOX — tile background texture at the current y position.
  2. BOX::BOX_HIGHLIGHT — highlight overlay when this box is selected.
  3. If in_box is true: the active option_box's full content (description, value buttons).
  4. Blue arrow indicators (BACKGROUND::BLUE_ARROW) on either side when an option is navigable but not currently highlighted.
  5. The label text centred on the tile.

Clone this wiki locally