summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-01-04 00:31:46 -0700
committerMike Buland <eichlan@xagasoft.com>2012-01-04 00:31:46 -0700
commit8f3b08c826f1174019386c0bfe22627bb269123d (patch)
tree1c9b0bcb10f32a64b6b268316856762e6c6b6a0d /src
parentd8f0276ec9d3b538a5ef8918a3072e3528a480d5 (diff)
downloadstage-8f3b08c826f1174019386c0bfe22627bb269123d.tar.gz
stage-8f3b08c826f1174019386c0bfe22627bb269123d.tar.bz2
stage-8f3b08c826f1174019386c0bfe22627bb269123d.tar.xz
stage-8f3b08c826f1174019386c0bfe22627bb269123d.zip
Attempt to generate version.h from git.
Diffstat (limited to 'src')
-rw-r--r--src/.gitignore1
-rw-r--r--src/main.cpp4
-rw-r--r--src/options.cpp25
-rw-r--r--src/options.h20
4 files changed, 50 insertions, 0 deletions
diff --git a/src/.gitignore b/src/.gitignore
index 6f29247..3492adb 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -2,3 +2,4 @@ parser.tab.c
2parser.tab.h 2parser.tab.h
3parser.yy.c 3parser.yy.c
4parser.yy.h 4parser.yy.h
5version.h
diff --git a/src/main.cpp b/src/main.cpp
index 6646d79..7e2ef7f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,6 +1,7 @@
1#include "gamebuilder.h" 1#include "gamebuilder.h"
2#include "game.h" 2#include "game.h"
3#include "gamestate.h" 3#include "gamestate.h"
4#include "options.h"
4 5
5#include <stdlib.h> 6#include <stdlib.h>
6#include <time.h> 7#include <time.h>
@@ -14,6 +15,9 @@ using namespace Bu;
14 15
15int main( int argc, char *argv[] ) 16int main( int argc, char *argv[] )
16{ 17{
18 Options &opt = Options::getInstance();
19 opt.parse( argc, argv );
20
17 srandom( time( NULL ) ); 21 srandom( time( NULL ) );
18 22
19 GameBuilder bld; 23 GameBuilder bld;
diff --git a/src/options.cpp b/src/options.cpp
new file mode 100644
index 0000000..7953add
--- /dev/null
+++ b/src/options.cpp
@@ -0,0 +1,25 @@
1#include "options.h"
2#include "version.h"
3
4#include <bu/optparser.h>
5
6Options::Options()
7{
8}
9
10Options::~Options()
11{
12}
13
14void Options::parse( int argc, char *argv[] )
15{
16 Bu::OptParser opt;
17
18 opt.addHelpBanner("STAGE v" FULLVER
19 " - Simple, Textual, Adventure Game Environment");
20 opt.addHelpBanner("usage: " + Bu::String(argv[0]) +
21 " [options] <filename>\n");
22 opt.addHelpOption('h', "help");
23 opt.parse( argc, argv );
24}
25
diff --git a/src/options.h b/src/options.h
new file mode 100644
index 0000000..42caa53
--- /dev/null
+++ b/src/options.h
@@ -0,0 +1,20 @@
1#ifndef OPTIONS_H
2#define OPTIONS_H
3
4#include <bu/singleton.h>
5#include <bu/string.h>
6
7class Options : public Bu::Singleton<Options>
8{
9friend class Bu::Singleton<Options>;
10private:
11 Options();
12 virtual ~Options();
13
14public:
15 void parse( int argc, char *argv[] );
16
17 Bu::String sFile;
18};
19
20#endif