nsnake
Classic snake game for the terminal
Main Page
Namespaces
Classes
Files
File List
src
Config
Globals.hpp
1
#ifndef GLOBALS_H_DEFINED
2
#define GLOBALS_H_DEFINED
3
4
#include <Interface/Colors.hpp>
5
6
#include <string>
7
8
// Avoiding cyclic #includes
9
struct
ScoreEntry
;
10
13
namespace
Globals
14
{
23
void
init
();
24
30
void
exit
();
31
33
void
loadFile
();
34
36
void
saveFile
();
37
38
// Accessing version numbers - version[MAJOR] for example
39
#define MAJOR 0
40
#define MINOR 1
41
#define PATCH 2
42
52
extern
char
version
[3];
53
54
namespace
Config
55
{
61
extern
std::string directory;
62
66
extern
std::string file;
67
71
extern
std::string scoresFile;
72
};
73
74
namespace
Screen
75
{
76
extern
bool
center_horizontally;
77
extern
bool
center_vertically;
78
79
extern
bool
show_borders;
80
extern
bool
fancy_borders;
81
extern
bool
outer_border;
82
};
83
84
namespace
Game
85
{
86
extern
unsigned
int
starting_speed;
87
88
extern
int
fruits_at_once;
89
extern
bool
random_walls;
90
extern
bool
teleport;
91
92
// The board size
93
enum
BoardSize
94
{
95
SMALL, MEDIUM, LARGE
96
};
97
BoardSize intToBoardSize(
int
val);
98
int
boardSizeToInt(BoardSize size);
99
100
extern
BoardSize board_size;
101
102
extern
int
board_scroll_delay;
103
104
extern
bool
board_scroll_up;
105
extern
bool
board_scroll_down;
106
extern
bool
board_scroll_left;
107
extern
bool
board_scroll_right;
108
111
extern
std::string current_level;
112
};
113
114
namespace
Theme
115
{
116
extern
ColorPair text;
117
extern
ColorPair hilite_text;
118
extern
ColorPair textbox;
119
};
120
121
// Flags to warn the user of some error at the end
122
// of execution.
123
namespace
Error
124
{
126
extern
bool
has_config_file;
127
129
extern
bool
has_score_file;
130
132
extern
bool
old_version_score_file;
133
135
extern
bool
strange_score_file;
136
};
137
};
138
139
#endif //GLOBALS_H_DEFINED
140
Globals::saveFile
void saveFile()
Saves current configurations to the default file name.
Definition:
Globals.cpp:273
Globals::exit
void exit()
Warns the user about any errors and warnings found during the program's execution.
Definition:
Globals.cpp:143
Globals::loadFile
void loadFile()
Loads configuration from the default file name.
Definition:
Globals.cpp:174
Globals::version
char version[3]
Game version (format MMP - Major Minor Patch).
Definition:
Globals.cpp:13
Globals::init
void init()
Allocates necessary variables.
Definition:
Globals.cpp:82
Game
Definition:
Game.hpp:16
ScoreEntry
A single entry on the high-score file.
Definition:
ScoreFile.hpp:27
Globals
All global settings to the game.
Definition:
Globals.hpp:13
Generated on Wed Aug 24 2016 02:49:12 for nsnake by
1.8.11