#include "TickDriver.h"

#include "Tick.h"

int TickDriver::advance(double elapsedWallMs, double gameSpeedMultiplier)
{
    m_accumulatorMs += elapsedWallMs * gameSpeedMultiplier;

    int ticks = 0;
    while (m_accumulatorMs >= kTickDurationMs)
    {
        m_accumulatorMs -= kTickDurationMs;
        ++ticks;
    }
    return ticks;
}

void TickDriver::reset()
{
    m_accumulatorMs = 0.0;
}
