Skip to content

Instantly share code, notes, and snippets.

@Thumperrr
Created November 14, 2013 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Thumperrr/2d06e5a605a73aa4131b to your computer and use it in GitHub Desktop.
Save Thumperrr/2d06e5a605a73aa4131b to your computer and use it in GitHub Desktop.
State Example
#ifndef IntroApplicationState_HeaderPlusPlus
#define IntroApplicationState_HeaderPlusPlus
#include "Application.hpp"
#include "AppState.hpp"
#include "ChessPlusPlusState.hpp"
namespace chesspp
{
class Application;
class IntroState : public AppState
{
sf::Clock timer;
public:
IntroState(Application &_app, sf::RenderWindow &disp)
: AppState(_app, disp)
{
}
~IntroState()
{
}
void onRender() override
{
if(timer.getElapsedTime().asSeconds() >= 5)
app.changeState<ChessPlusPlusState>(std::ref(app), std::ref(display));
}
void onLButtonPressed(int x, int y)
{
app.changeState<ChessPlusPlusState>(std::ref(app), std::ref(display));
}
};
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment