From 1a4780bad1cc40b43ebe6d93baba0f89572194d4 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Fri, 20 Oct 2017 08:14:01 -0400 Subject: better pausing --- src/gametime.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gametime.cpp b/src/gametime.cpp index 6f6ac0e..7ef824c 100644 --- a/src/gametime.cpp +++ b/src/gametime.cpp @@ -17,6 +17,10 @@ namespace game { paused = state; } + bool isPaused(void) { + return paused; + } + void setTickCount(unsigned int t) { tickCount = t; } @@ -30,11 +34,13 @@ namespace game { } void tick(void) { - tickCount++; + if (!paused) + tickCount++; } void tick(unsigned int ticks) { - tickCount += ticks; + if (!paused) + tickCount += ticks; } void mainLoopHandler(void) { @@ -52,7 +58,7 @@ namespace game { static unsigned int accum = 0; accum += deltaTime; - if (accum > MSEC_PER_TICK) { + if (!paused && accum > MSEC_PER_TICK) { accum = 0.0f; return true; } -- cgit v1.2.3