Example #1
0
static void SingleGameLoop()
{
	while (GameRunning) {
		DisplayLoop();
		GameLogicLoop();
	}
}
Example #2
0
int main(int, char const**) {
    // Start the game loop
    while (gameManager.GetWindow().isOpen()) {
        sf::Event event;
        while(gameManager.GetWindow().pollEvent(event)) {
            if((event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) ||
                    event.type == sf::Event::Closed) {
                gameManager.GetWindow().close();
            }
            if(gameManager.GameHasFinished()) {
                if(event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::R) {
                    gameManager.RestartGameAndClearScoresAndLives();
                }
            }
        }
        gameManager.ProcessInput();
        RenderingLoop();
        GameLogicLoop();
    }
    return EXIT_SUCCESS;
}