Skip to content

loading

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

The loading screen parses all configured song files, computes per-difficulty hashes, and registers them with scores before advancing to the title screen. All parsing work runs on a background thread so the progress bar can update smoothly.

LoadingScreen

Inherits from Screen. Constructed with the screen name "loading".

Members

Member Type Description
loading_complete atomic<bool> Set to true by the background thread when all songs are processed
progress atomic<float> Fraction of songs processed (0.0–1.0), written by the background thread
songs vector<fs::path> Full list of song file paths collected at startup
loading_thread thread Background thread running load_song_hashes()
fade_in unique_ptr<FadeAnimation> White fade-to-white played after loading completes, used to transition to the title screen
allnet_indicator AllNetIcon Online/offline status icon

Lifecycle

void on_screen_start() override;

Calls Screen::on_screen_start(), calculates progress bar geometry (43% of screen width, positioned at 85% screen height), creates the fade_in animation, collects all song file paths from the configured tja_path directories via get_song_files(), and launches loading_thread.

Screens on_screen_end(Screens next_screen) override;

Joins loading_thread before delegating to Screen::on_screen_end.

Update

std::optional<Screens> update() override;

Once loading_complete is set, starts the fade_in animation. When the fade finishes, calls on_screen_end and returns Screens::TITLE.

Background loading

void load_song_hashes(); // private, runs on loading_thread

Parses every song file using SongParser, computes a hash for each difficulty, and writes the results to scores inside a single database transaction. Work is distributed across all available hardware threads. After all songs are processed:

  • If scores_pytaiko.db exists in the working directory, imports it via scores_manager.py_taiko_import() and deletes the file.
  • Sets loading_complete = true.

Draw

void draw() override;

Draws a black background, a dark-red progress bar track, a red filled bar scaled to the current progress value, the KIDOU::WARNING skin texture, a white rectangle fading in over everything (driven by fade_in), and the allnet_indicator.

Clone this wiki locally