diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2017-10-20 08:14:01 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2017-10-20 08:14:01 -0400 |
commit | 1a4780bad1cc40b43ebe6d93baba0f89572194d4 (patch) | |
tree | 13751f28b667a778c6b6e2c268384ad1133be051 /src | |
parent | a9c145a4694d23ad6e9ee1e9816a0e7e4aeddfe2 (diff) |
better pausing
Diffstat (limited to 'src')
-rw-r--r-- | src/gametime.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
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; } |