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

Timer displays a countdown and fires a callback when it reaches zero. It uses skin animations for the number resize and highlight effects, and plays voice clips at 10 and 5 seconds. The countdown can be frozen via config.

Timer

Timer(int time, double current_time_ms, std::function<void()> confirm_func);

Initialises the countdown to time seconds. Retrieves animations from global_tex: number resize (ID 9), highlight resize (ID 10), and highlight fade (ID 11). Reads timer_frozen from the config at construction time.

confirm_func is called once, after the voice clip for 0 seconds has finished playing.

Update and Draw

void update(double current_ms);

Decrements the counter once per second. Plays timer_blip and starts the resize/highlight animations when the count falls below 10. Plays voice_timer_10, voice_timer_5, and voice_timer_0 at the corresponding values. Calls confirm_func after voice_timer_0 finishes. Does nothing while is_frozen is true.

void draw(float x = 0, float y = 0);

Draws the timer background (BG or BG_RED when below 10), the highlight overlay with its fade and resize animations, and each digit of the counter using the appropriate counter sprite (counter_black or counter_white). Digits are spaced by SC::TIMER_TEXT_MARGIN and centered horizontally.

Clone this wiki locally