namespace time {
void togglePause(void);
void togglePause(bool state);
+ bool isPaused(void);
/**
* Sets the game's tick count to the desired amount.
for (auto& e : clone)
game::events.emit<MainSDLEvent>(e);
- game::engine.update(game::time::getDeltaTime());
+ if (!game::time::isPaused())
+ game::engine.update(game::time::getDeltaTime());
std::this_thread::sleep_for(1ms);
});
paused = state;
}
+ bool isPaused(void) {
+ return paused;
+ }
+
void setTickCount(unsigned int t) {
tickCount = t;
}
}
void tick(void) {
- tickCount++;
+ if (!paused)
+ tickCount++;
}
void tick(unsigned int ticks) {
- tickCount += ticks;
+ if (!paused)
+ tickCount += ticks;
}
void mainLoopHandler(void) {
static unsigned int accum = 0;
accum += deltaTime;
- if (accum > MSEC_PER_TICK) {
+ if (!paused && accum > MSEC_PER_TICK) {
accum = 0.0f;
return true;
}