mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-31 01:25:21 +00:00
Adding a state and scene utils
This commit is contained in:
@@ -12,25 +12,6 @@ namespace WAL
|
||||
{
|
||||
std::chrono::nanoseconds Wal::timestep = 8ms;
|
||||
|
||||
void Wal::run()
|
||||
{
|
||||
auto lastTick = std::chrono::steady_clock::now();
|
||||
std::chrono::nanoseconds fBehind(0);
|
||||
|
||||
while (!this->_shouldClose) {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
std::chrono::nanoseconds dtime = now - lastTick;
|
||||
fBehind += dtime;
|
||||
lastTick = now;
|
||||
|
||||
while (fBehind > Wal::timestep) {
|
||||
fBehind -= Wal::timestep;
|
||||
this->_fixedUpdate();
|
||||
}
|
||||
this->_update(dtime);
|
||||
}
|
||||
}
|
||||
|
||||
void Wal::_update(std::chrono::nanoseconds dtime)
|
||||
{
|
||||
auto &entities = this->_scene.getEntities();
|
||||
|
||||
Reference in New Issue
Block a user