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

A Box is a single selectable tile in the box_manager on the entry screen. Each box stores its label text, current screen position, and two animations — one for sliding left/right and one for fading out when selected.

Box

Box(string text, BoxLocation location);

Initialises the box with the given display text and destination. Loads the MODE_SELECT texture and creates the move and open animations from the skin.

Members

Member Type Description
text string Display label drawn on the tile
location BoxLocation The destination this box routes to when confirmed
x float Current horizontal screen position
target_x float Position the move animation is easing toward
width float Tile width used for highlight extension calculations
selected bool Whether this box is the currently highlighted tile
move_anim Animation* Slide animation played during carousel navigation
open_anim Animation* Fade-out animation played when the box is confirmed

Positioning

void set_position(float x);

Sets both x and target_x immediately, with no animation.

void move_to(float target_x);

Sets target_x and starts the move_anim so the box eases to the new position.

State

void set_selected(bool selected);

Marks the box as highlighted. The highlighted box is drawn with left/right extension panels.

void start_open();

Triggers the open_anim fade-out, played when the player confirms this box.

bool is_animating() const;

Returns true while the move_anim is still running, used by box_manager to block further navigation inputs.

Draw

void draw();

Draws the tile texture at the current x position. If selected, also draws left and right extension highlight panels. The label text is drawn centred on the tile with a small vertical offset.

Clone this wiki locally