diff --git a/include/Spectre/Game/GameTime.h b/include/Spectre/Game/GameTime.h index 39cfcea..37aa167 100644 --- a/include/Spectre/Game/GameTime.h +++ b/include/Spectre/Game/GameTime.h @@ -18,10 +18,10 @@ public : Time getElapsed() const; - //bool shouldTick(); - bool beginFrame(); + bool shouldTick() const; + bool tick(); void reset(); diff --git a/source/Game/GameTime.cpp b/source/Game/GameTime.cpp index c6d8061..f8e2b64 100644 --- a/source/Game/GameTime.cpp +++ b/source/Game/GameTime.cpp @@ -32,12 +32,18 @@ bool GameTime::beginFrame() accumulateTime(); // Signal if we should tick + return shouldTick(); +} + +bool GameTime::shouldTick() const +{ + // if acc is larger than one slice, we have atleast one tick. return m_acc > m_slice; } bool GameTime::tick() { - if (m_acc > m_slice) { + if (shouldTick()) { m_acc -= m_slice; return true; }