Adding a state and scene utils

This commit is contained in:
Zoe Roux
2021-05-24 14:59:28 +02:00
parent 6f7e7ffaf9
commit 54fe800549
8 changed files with 136 additions and 32 deletions
-19
View File
@@ -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();