-
-
Save Thumperrr/2d06e5a605a73aa4131b to your computer and use it in GitHub Desktop.
State Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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