Skip to content

dan_select

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

The dan select screen lets the player browse and choose a dan (ranking) challenge course. It uses the skin name "dan_select". Course entries are managed by a local DanNavigator helper class.

DanNavigator

Manages the list of DanBox entries displayed on screen.

Members

Member Type Description
boxes vector<unique_ptr<DanBox>> All loaded dan course boxes
selected_index int Index of the currently focused course

Layout constants

Constant Value Description
BOX_CENTER 594 X position of the centre (focused) box
BASE_SPACING 150 Pixel spacing between adjacent boxes
SIDE_OFFSET_L 200 Additional left offset for non-centred boxes
SIDE_OFFSET_R 500 Additional right offset for non-centred boxes

Methods

void init(const vector<fs::path>& song_paths);

Loads a DanBox from each .json file found in song_paths, then calls set_positions(true, 0) to arrange them.

void move_left();
void move_right();

Decrement or increment selected_index (clamped) and animate all boxes to their new positions.

void skip(int delta);

Jump selected_index by delta and re-position all boxes.

DanBox* get_current();

Returns a pointer to the currently selected DanBox.

void update(double current_ms);
void draw();

Forward to each DanBox.


DanSelectScreen

Inherits from Screen. Constructed with the name "dan_select".

Members

Member Type Description
dan_navigator DanNavigator Manages course boxes
coin_overlay CoinOverlay Global coin/free-play display
allnet_indicator AllNetIcon Online connectivity indicator
indicator unique_ptr<Indicator> Input prompt displayed to the player
state SongSelectState BROWSING while navigating, SONG_SELECTED after confirming a course
is_confirmed bool Set to true once the player has committed to a course
confirm_fade FadeAnimation* Fade overlay drawn on confirmation before transitioning
last_moved double Timestamp of the last navigation input; used to debounce

Lifecycle

void on_screen_start() override;

Calls Screen::on_screen_start(), then initialises dan_navigator with the configured dan song paths and sets up the Indicator.

Screens on_screen_end(Screens next_screen) override;

Delegates to Screen::on_screen_end, which unloads all skin assets.

Update

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

Each frame:

  1. Calls Screen::update().
  2. Routes input to handle_input_browsing() or handle_input_selected() based on state.
  3. Updates dan_navigator, indicator, coin_overlay, and allnet_indicator.
  4. When confirm_fade finishes, loads the selected course into SessionData and returns Screens::GAME_DAN.

Returns std::nullopt while the screen is active.

Input Handling

void handle_input_browsing(double current_ms);

Left/right inputs navigate dan_navigator. A don press or confirm input sets state = SONG_SELECTED and calls handle_input_selected() immediately.

void handle_input_selected();

A don press sets is_confirmed = true and starts confirm_fade. The back key resets state to BROWSING. Pressing back from BROWSING returns Screens::SONG_SELECT.

Draw

void draw() override;

Renders in this order:

  1. dan_navigator.draw() — all course boxes.
  2. draw_confirm_overlay() — the confirmation fade when is_confirmed is true.
  3. indicator, coin_overlay, and allnet_indicator.

Clone this wiki locally