nsnake
Classic snake game for the terminal
Main Page
Namespaces
Classes
Files
File List
src
Game
Game.hpp
1
#ifndef GAME_H_DEFINED
2
#define GAME_H_DEFINED
3
4
#include <Game/ScoreFile.hpp>
5
#include <Game/Player.hpp>
6
#include <Game/Board.hpp>
7
#include <Game/FruitManager.hpp>
8
#include <Misc/Timer.hpp>
9
#include <Interface/Menu/Menu.hpp>
10
11
#include <vector>
12
13
// Pre-defining it's layout to avoid circular dependency.
14
class
LayoutGame
;
15
16
class
Game
17
{
18
friend
class
LayoutGame
;
19
20
public
:
21
Game
();
22
virtual
~
Game
();
23
34
void
start
(std::string levelName=
""
);
35
36
void
handleInput();
37
void
update();
38
void
draw();
39
40
bool
isOver();
41
43
bool
willQuit
();
44
46
bool
willReturnToMenu
();
47
50
int
getDelay
(
int
speed);
51
52
void
pause
(
bool
option);
53
54
// GameStateGame needs them to be public
55
59
ScoreFile
*
scores
;
60
66
ScoreEntry
*
currentScore
;
67
68
protected
:
69
LayoutGame
* layout;
70
72
bool
gameOver
;
73
74
bool
userAskedToQuit;
75
bool
userAskedToGoToMenu;
76
79
Timer
timerSnake
;
80
83
Timer
timerBoard
;
84
85
// Times how long the user have been playing the game.
86
Timer
timer;
87
90
bool
isPaused
;
91
94
bool
showPauseMenu
;
95
98
bool
showHelp
;
99
101
Menu
*
pauseMenu
;
102
103
Player
* player;
104
Board
* board;
105
FruitManager
* fruits;
106
};
107
108
#endif //GAME_H_DEFINED
109
Game::showHelp
bool showHelp
If it's showing the help screen.
Definition:
Game.hpp:98
Game::showPauseMenu
bool showPauseMenu
If it's showing the pause menu.
Definition:
Game.hpp:94
ScoreFile
Stores points the player made on the game.
Definition:
ScoreFile.hpp:87
Game::gameOver
bool gameOver
If the game is over (board is full of blocks).
Definition:
Game.hpp:72
Game::pauseMenu
Menu * pauseMenu
Menu that's shown only when the user presses Pause.
Definition:
Game.hpp:101
Game::start
void start(std::string levelName="")
Starts game, optionally loading a level.
Definition:
Game.cpp:39
FruitManager
Controls how many Fruits are there and how they're spawned.
Definition:
FruitManager.hpp:22
Game::timerBoard
Timer timerBoard
Timer that tells when to scroll the board, if this game setting is activated.
Definition:
Game.hpp:83
Board
A level where the snake runs and eats fruits.
Definition:
Board.hpp:32
Game
Definition:
Game.hpp:16
Game::willReturnToMenu
bool willReturnToMenu()
If we'll return to the main menu.
Definition:
Game.cpp:323
ScoreEntry
A single entry on the high-score file.
Definition:
ScoreFile.hpp:27
Game::timerSnake
Timer timerSnake
Timer that tells when to move the player, based on the current speed).
Definition:
Game.hpp:79
LayoutGame::pause
Window * pause
Contains the pause menu.
Definition:
LayoutGame.hpp:42
Menu
List of selectable items.
Definition:
Menu.hpp:28
Game::getDelay
int getDelay(int speed)
Returns how much time (millisseconds) we need to wait for a specific #speed.
Definition:
Game.cpp:327
Timer
Definition:
Timer.hpp:7
Game::currentScore
ScoreEntry * currentScore
Current score for this level.
Definition:
Game.hpp:66
Player
Definition:
Player.hpp:23
LayoutGame
Definition:
LayoutGame.hpp:11
Game::willQuit
bool willQuit()
If we'll quit the game right away.
Definition:
Game.cpp:319
Game::isPaused
bool isPaused
If the game is paused.
Definition:
Game.hpp:90
Game::scores
ScoreFile * scores
All the current level's score.
Definition:
Game.hpp:59
Generated on Wed Aug 24 2016 02:49:12 for nsnake by
1.8.11