nsnake
Classic snake game for the terminal
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();
15  Arguments::parse(argc, argv);
16 
17  // Misc Initializations
19  Ncurses::init();
20  Colors::init();
21 
22  // Actually running the game
23  StateManager states;
24  states.run();
25 
26  // Finishing things
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 
void run()
Main entry point and game loop.
void saveFile()
Saves current configurations to the default file name.
Definition: Globals.cpp:273
void exit()
Warns the user about any errors and warnings found during the program&#39;s execution.
Definition: Globals.cpp:143
void seed()
Must be called before any of those.
Definition: Utils.cpp:41
Giga-class that switches from game states.
void loadFile()
Loads configuration from the default file name.
Definition: Globals.cpp:174
void init()
Allocates necessary variables.
Definition: Globals.cpp:82
bool init()
Initializes Ncurses mode.
Definition: Ncurses.cpp:3
void exit()
Quits Ncurses mode.
Definition: Ncurses.cpp:25