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

The result screen displays a player's performance summary after a song ends. There are three variants: ResultScreen (single player), Result2PScreen (two-player), and DanResultScreen (dan/ranking challenge mode). All three are constructed with a screen name that the base Screen class uses to load the correct skin textures and sounds.

ResultScreen

The single-player result screen. Inherits from Screen. Constructed with the name "result".

Members

Member Type Description
song_info unique_ptr<OutlinedText> Outlined text displaying the song title
fade_out FadeAnimation* Fade-to-black animation played when exiting the screen
allnet_indicator AllNetIcon Online connectivity indicator
coin_overlay CoinOverlay Global coin display
background optional<ResultBackground> Tiled background graphic; absent when a custom Loading.png is present
loading_graphic optional<ray::Texture2D> Song-specific Loading.png used as a full-screen background when present
start_ms double Timestamp (ms) when the screen started; used to gate input for 5 seconds
skipped_time double Timestamp of the first skip press; a second press 5 s later triggers exit
player_1 optional<ResultPlayer> The player's score display object
fade_in optional<FadeIn> Entry fade-in animation drawn over the background
song_num unique_ptr<SongNum> Song-count display

Lifecycle

void on_screen_start() override;

Calls Screen::on_screen_start(), starts BGM, initialises animations, and creates all member objects. If a Loading.png file exists next to the selected song, it is loaded as a full-screen texture instead of ResultBackground.

Screens on_screen_end(Screens next_screen) override;

Unloads loading_graphic if present, resets the session with reset_session(), then delegates to Screen::on_screen_end.

Update

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

Each frame:

  1. Calls Screen::update().
  2. Advances fade_in and player_1.
  3. After 5 seconds, begins accepting input via handle_input().
  4. When fade_out finishes, exits to Screens::GAME_OVER if the configured song limit has been reached; otherwise returns to Screens::SONG_SELECT.

Returns std::nullopt while the screen is still running.

Input Handling

void handle_input(); // protected

Requires the fade-in to have finished before accepting any input. The first don press records skipped_time. A second press at least 5 s after skipped_time starts fade_out.

Draw

void draw() override;

Renders in this order:

  1. background->draw() or the loading_graphic stretched to fill the screen.
  2. draw_song_info() — song number and title.
  3. player_1->draw().
  4. draw_overlay() — fade-in panel, fade-out black rectangle, coin overlay, allnet indicator.

Result2PScreen

Two-player result screen. Inherits from ResultScreen. Constructed with the same "result" name so it shares the single-player skin.

Additional members

Member Type Description
player_2 optional<ResultPlayer> Score display for player 2 (2P)

Behaviour differences

  • on_screen_start() calls the parent, then discards any loading_graphic and always constructs ResultBackground with PlayerNum::TWO_PLAYER. player_1 is rebuilt with has_2p = true, and player_2 is created with is_2p = true.
  • update() advances both player_1 and player_2 together. Always exits to Screens::SONG_SELECT_2P.
  • draw() draws both players sequentially after background.

DanResultScreen

Dan-mode result screen. Inherits from Screen. Constructed with the name "dan_result". Displays two pages: a per-song breakdown (page 1) and a cumulative summary with exam results and pass/fail verdict (page 2).

Members

Member Type Description
allnet_indicator AllNetIcon Online connectivity indicator
coin_overlay CoinOverlay Global coin display
fade_out FadeAnimation* Fade-to-black when exiting
page2_fade FadeAnimation* Fade animation that reveals page 2
background optional<ResultBackground> Background drawn with PlayerNum::DAN
gauge unique_ptr<ResultGauge> Dan gauge (currently disabled in source)
hori_name unique_ptr<OutlinedText> Outlined text of the dan course title
song_names vector<unique_ptr<OutlinedText>> Outlined text for each song in the dan course
is_page2 bool Whether the screen is showing page 2

Lifecycle

void on_screen_start() override;

Starts BGM, grabs both fade animations, creates the background, and builds hori_name and song_names from the session's dan_result_data.

Screens on_screen_end(Screens next_screen) override;

Calls reset_session(), then delegates to Screen::on_screen_end. Always returns Screens::DAN_SELECT.

Update

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

Calls handle_input() every frame (input is always active on this screen). Advances both fade animations. Returns to Screens::DAN_SELECT when fade_out completes.

Input Handling

void handle_input(); // private

A don press on the first page starts page2_fade and sets is_page2 = true. A don press on the second page starts fade_out.

Draw

void draw() override;

Renders in this order:

  1. background->draw().
  2. draw_page1() — always visible.
  3. draw_page2(page2_fade->attribute) — fades in over page 1 when page2_fade is running.
  4. Black rectangle keyed to fade_out->attribute.
  5. coin_overlay and allnet_indicator.

draw_page1

Iterates over each DanResultSong in the session. For each song it draws:

  • Genre banner.
  • Song name (right-aligned outlined text).
  • Song number, difficulty badge, difficulty star/× symbols, and difficulty level digits.
  • Good, OK, Bad, and drumroll counters drawn using the RESULT_INFO::COUNTER texture.

draw_page2

Draws the full-page summary: background panels, column dividers, pull-out graphic, and the dan emblem. Shows totals for Good, OK, Bad, drumroll, max combo, and total hit count across all songs. Also shows the score box and calls draw_exam_info().

After computing exam results it draws one of three verdict textures:

  • EXAM_INFO::FAIL — any exam failed.
  • EXAM_INFO::GOLD_CLEAR — all exams passed and all reached the gold threshold.
  • EXAM_INFO::RED_CLEAR — all exams passed but at least one did not reach gold.

draw_exam_info

Renders each exam row: background panel, progress bar (red/gold/max texture chosen from DanResultExam.bar_texture), exam-type icon, required value, comparison operator (more/less), current value, and a FAILED overlay when the exam was not passed.

Clone this wiki locally