Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "Engine.h"
- void Engine::Start(void)
- {
- if (gameState != Uninitialized)
- return;
- gameWindow.create(sf::VideoMode(1024, 768, 32), "Hope Rides Alone!");
- gameState = Engine::Playing;
- while (!IsExiting())
- {
- GameLoop();
- }
- gameWindow.close();
- }
- bool Engine::IsExiting()
- {
- if (gameState == Engine::Exiting)
- return true;
- else
- return false;
- }
- void Engine::GameLoop()
- {
- sf::Event currentEvent;
- while(gameWindow.pollEvent(currentEvent))
- {
- switch(gameState)
- {
- case Engine::Playing:
- {
- gameWindow.clear(sf::Color(255,0,0));
- gameWindow.display();
- if(currentEvent.type == sf::Event::Closed)
- {
- gameState = Engine::Exiting;
- }
- break;
- }
- }
- }
- }
- Engine::GameState Engine::gameState = Uninitialized;
- sf::RenderWindow gameWindow;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement