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

The Combo class displays the player's current consecutive-note streak as large animated digits. A new instance is constructed each time the combo changes, replacing the previous one. player holds the active Combo as combo_display.

Combo

Construction

Combo(int combo, double current_ms);

Initialises the digit string, allocates a TextStretchAnimation for the pop effect, and precomputes per-digit colour and glimmer state. current_ms is used as the animation start time.

Members

Member Type Description
combo int The combo count this instance represents
stretch TextStretchAnimation* Squash-and-stretch animation played when the combo count increases
color vector<ray::Color> Per-digit colour; digits may be tinted differently at high combos
glimmer_map unordered_map<int, int> Maps digit index to a glimmer phase offset for the shimmer effect
total_time int Total duration of one glimmer cycle (ms)
cycle_time int Duration of one glimmer period per digit (ms)
start_times vector<double> Per-digit animation start timestamps

Methods

void update(double current_ms, int curr_combo);

Advances the stretch animation. If curr_combo differs from combo, calls update_count() to rebuild the display for the new value.

void draw(float y);

Draws each digit of the combo number at the configured screen position, applying the current stretch scale and per-digit colour/glimmer.

Private methods

void update_count(int combo);

Updates the stored combo value, resets the stretch animation, and recomputes color and glimmer_map for the new digit count.

Clone this wiki locally