Skip to content

box_folder

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

This page covers the two box_base subclasses that represent navigable containers in the navigator: FolderBox for regular song directories and DanBox for Dan challenge entries.


FolderBox

FolderBox represents a directory that contains songs or sub-folders. It displays a song count, the best crowns achieved across all songs inside, and supports inline expansion when the directory has no child sub-folders.

FolderBox(const fs::path& path, const BoxDef& box_def,
          map<pair<string,string>, fs::path>& song_files);

Scans song_files to count how many songs belong to this folder and computes the best Crown per difficulty across all of them. Stores those results in crown and tja_count.

Members

Member Type Description
tja_count int Number of songs (.tja files) inside this folder
is_osu_folder bool true when the folder contains .osu format songs
crown map<int, Crown> Best crown achieved per difficulty index across all songs in the folder
entered bool true once the player has entered this folder at least once
enter_fade unique_ptr<FadeAnimation> Fade animation played on entry
box_texture optional<ray::Texture> Custom box texture loaded from box.def, if provided
hori_name unique_ptr<OutlinedText> Title text in the horizontal (closed) orientation
tja_count_text unique_ptr<OutlinedText> Rendered song-count string

Lifecycle

void load_text() override;

Creates hori_name and tja_count_text from the stored name and count. Also loads the custom box_texture from the skin path specified in box.def if present.

void update(double current_time) override;

Advances all base animations and the enter_fade.

void refresh_scores(map<pair<string,string>, fs::path>& song_files);

Recomputes crown by walking song_files and reloading score data. Called when the navigator performs a global score refresh.

Folder Entry

void enter_box() override;

Sets entered = true, plays the enter_fade animation, and calls the base expand_box() visuals to signal the navigator to load its contents.

void exit_box() override;

Reverses the enter_fade and resets the visual state for re-display in the parent list.

Drawing

void draw_closed() override; // protected

Draws the folded box: background texture (custom or genre-default), folder name, song count, and crown icons.

void draw_open() override; // protected

Draws the expanded folder header shown while the inline song list is loading or displayed.

// private
void draw_open_bg(float fade);
void draw_open_fg(float fade);

Split the open-state draw into background and foreground layers so the box_base can be sandwiched between them.


DanBox

DanBox represents a Dan challenge — a fixed sequence of songs with pass/fail conditions. It is read from a dedicated Dan definition file rather than a directory.

DanBox(const fs::path& path, const string& title, int color,
       const vector<DanSongEntry>& songs, const vector<Exam>& exams,
       int total_notes);

Stores the challenge title, colour code, song list, exam conditions, and total note count.

Members

Member Type Description
dan_title string Display name of the Dan challenge
dan_color int Colour index controlling the box's visual theme
songs vector<DanSongEntry> Ordered list of songs in the challenge
exams vector<Exam> Pass/fail conditions evaluated at the end of the run
total_notes int Total note count across all songs, shown on the expanded box
hori_name unique_ptr<OutlinedText> Challenge title in horizontal orientation
song_texts vector<pair<OutlinedText, OutlinedText>> Per-song title and subtitle text pairs

Lifecycle

void load_text() override;

Creates hori_name and all song_texts pairs from the stored song list.

void update(double current_ms) override;

Advances base animations. No preview music or score logic.

Drawing

void draw_closed() override; // protected

Draws the Dan box with its themed colour stripe and challenge title.

void draw_open() override; // protected

Draws the expanded view: challenge title, total note count, the list of songs with their titles, and the exam condition boxes.

void draw_diff_select(bool is_ura) override; // protected

Calls draw_open() — Dan challenges do not have a separate difficulty-select view since the course is fixed.

// private
void draw_exam_box();

Renders the exam condition panels showing each pass/fail criterion.

// private
void draw_digit_counter(const string& digits, float margin_x, float y, TexID digit_tex);

Renders a numeric value using individual digit textures, right-aligned from margin_x.

Clone this wiki locally