nsnake
Classic snake game for the terminal
src
main.cpp
1
#include <Flow/StateManager.hpp>
2
#include <Interface/Ncurses.hpp>
3
#include <Interface/Colors.hpp>
4
#include <Config/Globals.hpp>
5
#include <Config/Arguments.hpp>
6
#include <Misc/Utils.hpp>
7
8
int
main(
int
argc,
char
*argv[])
9
{
10
try
11
{
12
// Settings
13
Globals::init
();
14
Globals::loadFile
();
15
Arguments::parse(argc, argv);
16
17
// Misc Initializations
18
Utils::Random::seed
();
19
Ncurses::init
();
20
Colors::init();
21
22
// Actually running the game
23
StateManager
states;
24
states.
run
();
25
26
// Finishing things
27
Globals::saveFile
();
28
Ncurses::exit
();
29
Globals::exit
();
30
}
31
catch
(...)
32
{
33
// I dont really have a nice exception-handling scheme right
34
// now. I must learn how to properly deal with them.
35
Ncurses::exit
();
36
return
666;
37
}
38
return
0;
39
}
40
StateManager::run
void run()
Main entry point and game loop.
Definition:
StateManager.cpp:23
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
Utils::Random::seed
void seed()
Must be called before any of those.
Definition:
Utils.cpp:41
StateManager
Giga-class that switches from game states.
Definition:
StateManager.hpp:22
Globals::init
void init()
Allocates necessary variables.
Definition:
Globals.cpp:82
Ncurses::exit
void exit()
Quits Ncurses mode.
Definition:
Ncurses.cpp:25
Ncurses::init
bool init()
Initializes Ncurses mode.
Definition:
Ncurses.cpp:3
Globals::saveFile
void saveFile()
Saves current configurations to the default file name.
Definition:
Globals.cpp:273
Generated on Wed Jan 29 2020 00:00:00 for nsnake by
1.8.17