Moved the clock check outside of the event loop
It caused the game to update only if events were received (Mouse movement, button press, etc)
This commit is contained in:
parent
81364c7b4c
commit
d53f8b32e9
3 changed files with 7 additions and 7 deletions
10
src/Game.cpp
10
src/Game.cpp
|
@ -51,11 +51,11 @@ void Game::runGame()
|
|||
{
|
||||
window.close();
|
||||
}
|
||||
if (clock.getElapsedTime().asMilliseconds() >= 200)
|
||||
{
|
||||
currentLevel->runStep();
|
||||
clock.restart();
|
||||
}
|
||||
}
|
||||
if (clock.getElapsedTime().asMilliseconds() >= 200)
|
||||
{
|
||||
currentLevel->runStep();
|
||||
clock.restart();
|
||||
}
|
||||
window.clear(sf::Color::White);
|
||||
// TODO : Consider drawing in a sf::RenderTexture to allow positioning the level at a fixed position ?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue