nsnake
Classic snake game for the terminal
Loading...
Searching...
No Matches
GameState.hpp
1#ifndef GAMESTATE_H_DEFINED
2#define GAMESTATE_H_DEFINED
3
32{
33public:
40 {
41 // Internal codes for quitting and continuing
42 QUIT, CONTINUE,
43
44 // The actual game screens
45 MAIN_MENU,
46 GAME_START,
47 GAME_OVER
48 };
49
50 // Left this here just because.
51 virtual ~GameState() {};
52
58 virtual void load(int stack=0) = 0;
59
64 virtual int unload() = 0;
65
72 virtual StateCode update() = 0;
73
75 virtual void draw() = 0;
76
77private:
78};
79
80#endif //GAMESTATE_H_DEFINED
81
Abstract definition of a game state.
Definition GameState.hpp:32
StateCode
All possible transitions between states.
Definition GameState.hpp:40
virtual int unload()=0
Where every state destroys it's resources.
virtual void draw()=0
Called every frame, where states draw stuff on screen.
virtual StateCode update()=0
Called every frame, where states calculate everything that can change.
virtual void load(int stack=0)=0
Where every state initializes it's resources.