Level updates are now triggered at timed intervals

This commit is contained in:
Teo-CD 2019-06-08 01:14:52 +02:00
parent dafc442512
commit 81364c7b4c

View file

@ -20,8 +20,6 @@ void Game::loadLevel(int levelId)
if(!result)
{
// std::cerr << "Error while loading level :\n" << "\t" << result.description() << std::endl;
// exit(-1);
pro_maat::errorWindow(result.description());
}
@ -42,6 +40,8 @@ void Game::runGame()
{
sf::RenderWindow window(sf::VideoMode(1280,1024),"Project Maat");
sf::Clock clock;
while (window.isOpen())
{
sf::Event event;
@ -51,10 +51,10 @@ void Game::runGame()
{
window.close();
}
// FIXME : For testing purposes
if (event.type == sf::Event::KeyPressed)
if (clock.getElapsedTime().asMilliseconds() >= 200)
{
currentLevel->runStep();
clock.restart();
}
}
window.clear(sf::Color::White);