nsnake
Classic snake game for the terminal
Public Member Functions | Public Attributes | Protected Attributes | Friends | List of all members
Game Class Reference
Collaboration diagram for Game:
Collaboration graph
[legend]

Public Member Functions

void start (std::string levelName="")
 Starts game, optionally loading a level. More...
 
void handleInput ()
 
void update ()
 
void draw ()
 
bool isOver ()
 
bool willQuit ()
 If we'll quit the game right away.
 
bool willReturnToMenu ()
 If we'll return to the main menu.
 
int getDelay (int speed)
 Returns how much time (millisseconds) we need to wait for a specific #speed. More...
 
void pause (bool option)
 

Public Attributes

ScoreFilescores
 All the current level's score. More...
 
ScoreEntrycurrentScore
 Current score for this level. More...
 

Protected Attributes

LayoutGamelayout
 
bool gameOver
 If the game is over (board is full of blocks).
 
bool userAskedToQuit
 
bool userAskedToGoToMenu
 
Timer timerSnake
 Timer that tells when to move the player, based on the current speed). More...
 
Timer timerBoard
 Timer that tells when to scroll the board, if this game setting is activated. More...
 
Timer timer
 
bool isPaused
 If the game is paused. More...
 
bool showPauseMenu
 If it's showing the pause menu. More...
 
bool showHelp
 If it's showing the help screen. More...
 
MenupauseMenu
 Menu that's shown only when the user presses Pause.
 
Playerplayer
 
Boardboard
 
FruitManagerfruits
 

Friends

class LayoutGame
 

Detailed Description

Definition at line 16 of file Game.hpp.

Member Function Documentation

int Game::getDelay ( int  speed)

Returns how much time (millisseconds) we need to wait for a specific #speed.

Definition at line 327 of file Game.cpp.

void Game::start ( std::string  levelName = "")

Starts game, optionally loading a level.

Note
This is not the path to the level file! It's merely a level name.
See also
BoardParser::load
Note
If no level name is specified, will default to an empty box.

Definition at line 39 of file Game.cpp.

Member Data Documentation

ScoreEntry* Game::currentScore

Current score for this level.

It shall get increased with time and in the end we'll test to see if it can enter this level's high score list.

Definition at line 66 of file Game.hpp.

bool Game::isPaused
protected

If the game is paused.

May show other Windows while paused.

Definition at line 90 of file Game.hpp.

ScoreFile* Game::scores

All the current level's score.

It allows to read all the scores on this level, independent of game settings.

Definition at line 59 of file Game.hpp.

bool Game::showHelp
protected

If it's showing the help screen.

Goes together with isPaused.

Definition at line 98 of file Game.hpp.

bool Game::showPauseMenu
protected

If it's showing the pause menu.

Goes together with isPaused.

Definition at line 94 of file Game.hpp.

Timer Game::timerBoard
protected

Timer that tells when to scroll the board, if this game setting is activated.

Definition at line 83 of file Game.hpp.

Timer Game::timerSnake
protected

Timer that tells when to move the player, based on the current speed).

Definition at line 79 of file Game.hpp.


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