#pragma once

// Accumulator-based fixed-timestep driver. Decouples wall-clock render rate
// from the 30 Hz simulation tick rate. See architecture.md §Render Loop.
class TickDriver
{
public:
    TickDriver() = default;

    // Adds elapsedWallMs * gameSpeedMultiplier to the accumulator and returns
    // how many simulation ticks should be stepped this frame. The remainder
    // stays in the accumulator for the next call.
    // A multiplier of 0.0 freezes accumulation (pause).
    // Valid multipliers per REQ-UI-SPEED: 0, 0.5, 1, 2, 4.
    int advance(double elapsedWallMs, double gameSpeedMultiplier);

    void reset();

private:
    double m_accumulatorMs = 0.0;
};
