mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-24 15:18:34 +00:00
Starting the game loop
This commit is contained in:
@@ -20,6 +20,8 @@ namespace WAL
|
||||
|
||||
Scene &SceneManager::getCurrent()
|
||||
{
|
||||
if (this->_scenes.empty())
|
||||
throw NotFoundError("No scene exists.");
|
||||
return this->_scenes.front();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Created by Zoe Roux on 2021-05-14.
|
||||
//
|
||||
|
||||
#include <chrono>
|
||||
#include "Wal.hpp"
|
||||
|
||||
namespace WAL
|
||||
@@ -14,6 +15,13 @@ namespace WAL
|
||||
|
||||
void WAL::run()
|
||||
{
|
||||
auto lastTick = std::chrono::steady_clock::now();
|
||||
|
||||
while (!this->_shouldClose) {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
auto dtime = now - lastTick;
|
||||
lastTick = now;
|
||||
// see https://gist.github.com/mariobadr/673bbd5545242fcf9482
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,8 @@ namespace WAL
|
||||
std::vector<std::unique_ptr<System>> _systems = {};
|
||||
//! @brief The renderer used to draw entities
|
||||
std::unique_ptr<Renderer> _renderer;
|
||||
//! @brief True if the engine should close after the end of the current tick.
|
||||
bool _shouldClose = false;
|
||||
public:
|
||||
//! @brief Create a new system in place.
|
||||
//! @return The wal instance used to call this function is returned. This allow method chaining.
|
||||
|
||||
Reference in New Issue
Block a user