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

The title screen loops through an attract mode sequence indefinitely until a don input is detected, at which point it transitions to the entry screen.

TitleState

An enum tracking which phase of the attract loop is active.

Value Description
OP_VIDEO A randomly selected opening video is playing
WARNING The warning_screen is displayed
ATTRACT_VIDEO A randomly selected attract video is playing
ATTRACT_CAMERA The live webcam feed, Bana advertisements, and camera cloud are displayed

TitleScreen

Inherits from Screen. Constructed with the screen name "title", which is used by the base class to load the correct textures and sounds.

Lifecycle

void on_screen_start() override;

Calls the base Screen::on_screen_start() to load screen textures and sounds, then calls load_videos(), sets the initial state to OP_VIDEO, creates the hit_taiko_text outlined text object from the skin config using the configured language, and retrieves the fade_out and text_overlay_fade animations from the skin.

void load_videos();

Scans Skins/<skin>/Videos/op_videos/ and Skins/<skin>/Videos/attract_videos/ recursively for .mp4 files and stores their paths in op_video_list and attract_video_list. Called on every screen start so the lists are always fresh. Logs a warning if either folder is missing.

Screens on_screen_end(Screens next_screen) override;

Releases the op_video and attract_video players before delegating to Screen::on_screen_end, which unloads all sounds, music, and textures.

Update

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

Calls Screen::update() to handle first-frame initialisation, then advances text_overlay_fade and fade_out. If fade_out has finished, calls on_screen_end and returns Screens::ENTRY. Otherwise calls scene_manager to advance the attract loop. If a left or right don input is detected (is_l_don_pressed / is_r_don_pressed), fade_out is started and the don sound is played. Returns std::nullopt while waiting.

void scene_manager(double current_ms); // private

Drives the four-state attract loop. Objects are created lazily (using std::optional) when their state is first entered and destroyed when it ends:

  • OP_VIDEO: Picks a random video from op_video_list and plays it. If the list is empty it skips straight to WARNING. When the video finishes it transitions to WARNING.
  • WARNING: Constructs a warning_screen and updates it. When it reports finished, transitions to ATTRACT_VIDEO.
  • ATTRACT_VIDEO: Picks a random video from attract_video_list and plays it. If the list is empty it falls back to OP_VIDEO. When the video finishes, transitions to ATTRACT_CAMERA.
  • ATTRACT_CAMERA: Constructs attract_camera, two bana_advert instances, and camera_cloud and updates them all. When attract_camera reports finished (after 30 seconds), all four objects are destroyed and the state returns to OP_VIDEO.

Draw

void draw() override;

Renders only the content appropriate for the current state:

  • OP_VIDEO — draws the op video player.
  • WARNING — draws WARNING::BACKGROUND then the warning_screen.
  • ATTRACT_VIDEO — draws the attract video player.
  • ATTRACT_CAMERA — draws the webcam feed, then camera_cloud, then the two bana_advert instances at fixed positions ((33, 136) and (1023, 136)).

After the state-specific content, every frame also draws:

  • A MOVIE::BACKGROUND overlay at fade_out opacity (the transition-out fade).
  • The coin_overlay, allnet_indicator, and entry_overlay global HUD objects.
  • The "Hit Taiko to Start" text drawn twice — once on the left quarter of the screen and once on the right — both faded by text_overlay_fade.

Clone this wiki locally