Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Game.cpp
- *
- * Created on: Jul 3, 2010
- * Author: itsbth
- */
- #include "Game.h"
- #include <SFML/System/Clock.hpp>
- namespace pw
- {
- Game::Game(sf::RenderWindow& App) :
- App(App)
- {
- // TODO Auto-generated constructor stub
- }
- Game::~Game()
- {
- // TODO Auto-generated destructor stub
- while (!States.empty())
- States.pop(); // Free all states
- }
- void Game::Run()
- {
- sf::Clock Clock;
- while (!States.empty())
- {
- sf::Event Event;
- while (App.GetEvent(Event))
- ;
- State& Top = *States.top();
- if (!Top.Update(Clock.GetElapsedTime()))
- {
- States.pop();
- continue;
- }
- Clock.Reset();
- App.Clear();
- Top.Draw(App);
- App.Display();
- }
- }
- /**
- * Get the input
- */
- const sf::Input& Game::GetInput() const
- {
- return App.GetInput();
- }
- }
Add Comment
Please, Sign In to add comment