nsnake
Classic snake game for the terminal
src
Flow
GameState.hpp
1
#ifndef GAMESTATE_H_DEFINED
2
#define GAMESTATE_H_DEFINED
3
31
class
GameState
32
{
33
public
:
39
enum
StateCode
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
77
private
:
78
};
79
80
#endif //GAMESTATE_H_DEFINED
81
GameState::draw
virtual void draw()=0
Called every frame, where states draw stuff on screen.
GameState::StateCode
StateCode
All possible transitions between states.
Definition:
GameState.hpp:40
GameState::unload
virtual int unload()=0
Where every state destroys it's resources.
GameState::update
virtual StateCode update()=0
Called every frame, where states calculate everything that can change.
GameState::load
virtual void load(int stack=0)=0
Where every state initializes it's resources.
GameState
Abstract definition of a game state.
Definition:
GameState.hpp:32
Generated on Tue Jul 28 2020 00:00:00 for nsnake by
1.8.18