Skip to content

box_base

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

BaseBox is the abstract base class for every item that can appear in the navigator's browsable list. The three concrete subclasses — box_song, box_folder, and BackBox — inherit from it and override the virtual draw and lifecycle methods.

BaseBox

BaseBox(const fs::path& path, const BoxDef& box_def);

Stores the file path and all BoxDef fields, retrieves the fade and open_anim/open_fade animations from the skin, and sets the initial position to off-screen right.

Members

Member Type Description
text_loaded bool Set after load_text() runs; prevents repeated text loading
genre_index GenreIndex Genre category, drives the scrolling background colour
text_name string Raw display name string
collection string Collection type tag (e.g. "RECENT", "FAVORITE")
texture_index TextureIndex Which skin texture to use for the box background
back_color optional<ray::Color> Custom background colour, overrides the skin default
fore_color optional<ray::Color> Custom foreground/text colour
fade FadeAnimation* Controls overall box opacity
position float Current x-position on screen
left_bound float Leftmost x-position at which the box is still drawn
right_bound float Rightmost x-position at which the box is still drawn
path fs::path File system path this box represents
is_new bool true for songs added within the last two weeks
preserve_order bool Prevents reordering when the navigator sorts items

Lifecycle

virtual void load_text();

Renders the name outlined text object from text_name. Called once by the navigator when the box is first flushed from the pending queue. Subclasses extend this to load additional text (subtitles, BPM, song counts, etc.).

virtual void update(double current_ms);

Advances the move, fade, open_anim, and open_fade animations, and updates the yellow_box if it exists.

virtual void reset();

Resets the box to its initial visual state. Called when navigating back out of a folder.

Position and Visibility

void set_position(float target_position);

Immediately places the box at target_position with no animation.

void move_box(float target_position, float duration);

Starts a MoveAnimation that slides the box to target_position over duration milliseconds.

void fade_in(float delay);

Starts the fade animation after delay milliseconds, bringing the box to full opacity.

void fade_out();

Starts a fade-out on the fade animation.

Open / Close

virtual void expand_box();

Called when this box becomes the selected item. Starts the open_anim and open_fade animations and creates a YellowBox if the skin defines one.

virtual void close_box();

Called when the selection moves away from this box. Reverses the open animations and destroys the YellowBox.

Folder Entry

virtual void enter_box();
virtual void exit_box();

Called by the navigator when the player enters or exits this box as a folder. BaseBox implementations are no-ops; FolderBox overrides both to play entry/exit animations.

Drawing

virtual void draw(bool is_ura);

Calls draw_closed() or draw_open() depending on whether the open animation is active, then draws the yellow_box if present.

virtual void draw_closed(); // protected
virtual void draw_open();   // protected

Subclasses override these to render the box in its collapsed and expanded states respectively.

virtual void draw_diff_select(bool is_ura);

Called instead of draw_open() when the navigator is in difficulty-select mode. The base implementation calls draw_open(); SongBox overrides this to draw the difficulty tile strip.


YellowBox

YellowBox is the expandable detail panel that slides out from the selected box. It is owned by BaseBox as optional<YellowBox> yellow_box and created only when the box is opened.

YellowBox();

Retrieves all movement and fade animations from the skin.

void create_anim();
void create_anim_2();

Start the two-phase expand animation. create_anim() slides the left and right wings out; create_anim_2() continues with the centre panel.

void reset();

Snaps all animations back to their initial values without playing them.

void update(double current_ms);

Advances all movement and fade animations.

void draw(float fade = 1.0);

Draws the left wing, right wing, and centre panel of the yellow detail box at the given opacity.

Members

Member Type Description
is_diff_select bool Whether the box is in difficulty-select mode (affects geometry)
left_x / right_x float Current x-extents of the side wings
center_width float Current width of the centre panel
top_y / bottom_y float Vertical bounds of the box
center_height float Current height of the centre panel
edge_height float Height of the top/bottom edge pieces
left_distance / right_distance float How far the wings travel during animation

Clone this wiki locally