nsnake
Classic snake game for the terminal
Loading...
Searching...
No Matches
GameStateGame Class Reference

This represents the actual game taking place. More...

#include <GameStateGame.hpp>

Inheritance diagram for GameStateGame:
Collaboration diagram for GameStateGame:

Public Member Functions

void load (int stack=0)
 Constructs everything necessary for the game.
 
int unload ()
 Destroys anything builded during the game.
 
GameState::StateCode update ()
 Updates all possible things on the game.
 
void draw ()
 Shows everything onscreen;.
 
- Public Member Functions inherited from GameState

Additional Inherited Members

- Public Types inherited from GameState
enum  StateCode {
  QUIT , CONTINUE , MAIN_MENU , GAME_START ,
  GAME_OVER
}
 All possible transitions between states. More...
 

Detailed Description

This represents the actual game taking place.

Here is defined all the game logic and rules.

For developers:

Before you continue, take a deep breath.

Done? OK. This is the most complex class of this game and it uses pretty much every other class on the project.

To understand it you must have a lot of patience and that "I'll see what it means later" feeling.

Don't try to understand everything at once! Try to abstract a litte and follow the code thinking only in terms of what you think it's doing.

After you've quite guessed what a method does, start looking into the classes that it uses.

Definition at line 29 of file GameStateGame.hpp.

Constructor & Destructor Documentation

◆ GameStateGame()

GameStateGame::GameStateGame ( )

Definition at line 9 of file GameStateGame.cpp.

◆ ~GameStateGame()

GameStateGame::~GameStateGame ( )
virtual

Definition at line 13 of file GameStateGame.cpp.

Member Function Documentation

◆ draw()

void GameStateGame::draw ( )
virtual

Shows everything onscreen;.

Implements GameState.

Definition at line 80 of file GameStateGame.cpp.

◆ load()

void GameStateGame::load ( int stack = 0)
virtual

Constructs everything necessary for the game.

Implements GameState.

Definition at line 15 of file GameStateGame.cpp.

◆ unload()

int GameStateGame::unload ( )
virtual

Destroys anything builded during the game.

Implements GameState.

Definition at line 41 of file GameStateGame.cpp.

◆ update()

GameState::StateCode GameStateGame::update ( )
virtual

Updates all possible things on the game.

Returns
A status code indicating what to do (should we change states/quit the game?). The codes are defined on GameState.hpp.

Implements GameState.

Definition at line 47 of file GameStateGame.cpp.


The documentation for this class was generated from the following files: