secret
Created

State Example

  • Download Gist
Intro.hpp
C++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.