-
Notifications
You must be signed in to change notification settings - Fork 6
input_cali
The input calibration screen measures the player's input latency and writes the result back to config. It runs the gameplay engine on a fixed calibration chart with auto-play enabled, then records the timing difference between each don hit and the auto-play note hit time.
Inherits from GameScreen. Uses the "game" skin assets.
| Member | Type | Description |
|---|---|---|
latencies |
vector<double> |
Raw latency samples collected from each don hit, in milliseconds |
average_latency |
double |
Median of all collected samples, updated after each hit |
average_latency_text |
optional<OutlinedText> |
Text object displaying the current median latency, recreated after each hit |
void on_screen_start() override;Sets session_data.selected_song to Songs/Calibration.tja and selected_difficulty to Hard (index 2), enables auto_play on the active player, then calls GameScreen::on_screen_start(). Resets the background object using the "TUTORIAL" theme at 150 BPM.
Screens on_screen_end(Screens next_screen) override;Disables auto_play, writes average_latency * -1 to config->general.audio_offset, then delegates to GameScreen::on_screen_end.
std::optional<Screens> update() override;Pressing the back key returns immediately to Screens::SETTINGS. Otherwise delegates to GameScreen::update():
- If the result is
Screens::SONG_SELECT(song ended normally), swallows it and stays on screen so the calibration loop continues. - If the result is
Screens::RESULT, returnsScreens::SETTINGSinstead — calibration is complete.
On each frame, if a left or right don is pressed, the latency is computed as players[0]->last_note_hit - current_ms (a negative value means the player hit early). The sample is appended to latencies and the median is recalculated. average_latency_text is rebuilt with the new value.
void draw() override;Draws the game background rear layer, the note lane for P1 at the standard y-position, the average_latency_text centered near the bottom of the screen (if at least one sample has been recorded), and the game background front layer and overlay.
Building
libs
- animation
- audio
- config
- filesystem
- global_data
- input
- logging
- ray
- scores
- screen
- script
- song_parser
- text
- texture
- video
- webcam
libs/parsers
objects
objects/game
- player
- background
- gauge
- judgment
- combo
- branch_indicator
- ending_animations
- gogo_time
- fireworks
- song_info
- transition
- result_transition
- judge_counter
- score_counter
- score_counter_animation
- balloon_counter
- drumroll_counter
- kusudama_counter
- drum_hit_effect
- lane_hit_effect
- gauge_hit_effect
- combo_announce
- note_arc
objects/global
objects/title
objects/entry
objects/settings
objects/result
objects/song_select
- player
- navigator
- box_base
- box_song
- box_folder
- neiro
- modifier
- ura_switch
- diff_sort
- search_box
- dan_transition
- genre_bg
- score_history
- song_select_script
scenes