Commit ed770734 authored by Robert Scott James's avatar Robert Scott James

Made an executable argument structure that is passed to the game class so that...

Made an executable argument structure that is passed to the game class so that it only needs one argument.

 Changes to be committed:
	modified:   ../src/game/game.cpp
	modified:   ../src/game/game.h
	modified:   ../src/main.cpp
parent 0f4687d6
......@@ -11,7 +11,7 @@
#include "../vroot.h"
#include "../lodepng/lodepng.h"
Game::Game(int _root,std::string _load):rootWindow(_root),levelToLoad(_load){
Game::Game(executableConfig_t executableArguments):rootWindow(executableArguments.root),levelToLoad(executableArguments.level){
}
Game::~Game(){
......
......@@ -13,10 +13,17 @@
#include <memory>
#include <X11/Xlib.h>
typedef struct {
std::string level;
int root;
} executableConfig_t;
class Game {
public:
Game(int,std::string);
Game(executableConfig_t);
~Game();
int readTiles(std::string,Display*&,Drawable,GC);
void loop();
......@@ -35,6 +42,4 @@ protected:
#endif
......@@ -12,11 +12,12 @@
//Debugging spaces
int main(int argc, char **argv){
int ROOT=0;
std::string LOAD;
executableConfig_t executableArguments;
executableArguments.root = 0;
const struct option longopts[] = {
{"root", no_argument, &ROOT,1},
{"root", no_argument, &executableArguments.root,1},
{"load", required_argument, 0, 'l'},
{0,0,0,0}
};
......@@ -28,11 +29,12 @@ int main(int argc, char **argv){
case 0:
break;
case 'l':
LOAD = std::string(optarg);
executableArguments.level = std::string(optarg);
break;
}
}
// Create a game class
Game main(ROOT,LOAD);
Game main(executableArguments);
main.loop();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment