diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-21 00:58:49 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-21 00:58:49 +1000 |
commit | 4b0bc220e4da1173f742a4973939b139bef562db (patch) | |
tree | 0ff66d5957575fa814fc10b8cd93e3dd378f45dc /source/game/StarSpawner.cpp | |
parent | 607be749451aa40e3619e7ceab0927d1fcec8233 (diff) |
Support for changing the game's timescale
Context-specific (like per-world) timescales can also be added later
Diffstat (limited to 'source/game/StarSpawner.cpp')
-rw-r--r-- | source/game/StarSpawner.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/game/StarSpawner.cpp b/source/game/StarSpawner.cpp index 4c54ed4..f64ccfe 100644 --- a/source/game/StarSpawner.cpp +++ b/source/game/StarSpawner.cpp @@ -73,7 +73,7 @@ void Spawner::activateEmptyRegion(RectF region) { m_activeSpawnCells[cell] = m_spawnCellLifetime; } -void Spawner::update() { +void Spawner::update(float dt) { if (!m_facade) return; @@ -82,10 +82,9 @@ void Spawner::update() { activateRegion(window.padded(m_windowActivationBorder)); } - eraseWhere(m_activeSpawnCells, [](auto& p) { - p.second -= WorldTimestep; - return p.second < 0.0f; - }); + eraseWhere(m_activeSpawnCells, [dt](auto& p) { + return (p.second -= dt) < 0.0f; + }); eraseWhere(m_spawnedEntities, [this](EntityId entityId) { auto entity = m_facade->getEntity(entityId); |