author | Tero Marttila <terom@fixme.fi> |
Mon, 26 Jan 2009 23:03:47 +0200 | |
changeset 431 | c6d7272a164b |
parent 418 | 194bc810a570 |
permissions | -rw-r--r-- |
358 | 1 |
#ifndef APPLICATION_HH |
2 |
#define APPLIATION_HH |
|
3 |
||
4 |
#include "Engine.hh" |
|
5 |
#include "Error.hh" |
|
6 |
||
7 |
#include <ClanLib/core.h> |
|
8 |
#include <ClanLib/application.h> |
|
9 |
||
10 |
class ArgumentError : public Error { |
|
11 |
public: |
|
12 |
ArgumentError (const std::string &message) : Error(message) { } |
|
13 |
}; |
|
14 |
||
15 |
/** |
|
16 |
* Our CL_ClanApplication. Provides our main function, handles argument parsing and interacts with Engine |
|
17 |
*/ |
|
18 |
class Main : public CL_ClanApplication { |
|
19 |
private: |
|
20 |
// arguments |
|
21 |
CL_CommandLine args; |
|
22 |
||
23 |
/** |
|
24 |
* --graphics |
|
25 |
*/ |
|
409
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
26 |
bool graphics_enabled; |
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
27 |
|
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
28 |
/** |
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
29 |
* --fullscreen and --resolution |
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
30 |
*/ |
417
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
31 |
DisplayConfig display; |
409
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
32 |
|
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
33 |
/** |
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
34 |
* --terrain-seed and --terrain-size |
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
35 |
*/ |
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
36 |
TerrainConfig terrain; |
358 | 37 |
|
38 |
/** |
|
418
194bc810a570
add --log-level option, improve Config/Logger documentation, fix NETWORK_EANBLED typos in Engine
Tero Marttila <terom@fixme.fi>
parents:
417
diff
changeset
|
39 |
* --log-level |
194bc810a570
add --log-level option, improve Config/Logger documentation, fix NETWORK_EANBLED typos in Engine
Tero Marttila <terom@fixme.fi>
parents:
417
diff
changeset
|
40 |
*/ |
194bc810a570
add --log-level option, improve Config/Logger documentation, fix NETWORK_EANBLED typos in Engine
Tero Marttila <terom@fixme.fi>
parents:
417
diff
changeset
|
41 |
EngineConfig engine; |
194bc810a570
add --log-level option, improve Config/Logger documentation, fix NETWORK_EANBLED typos in Engine
Tero Marttila <terom@fixme.fi>
parents:
417
diff
changeset
|
42 |
|
194bc810a570
add --log-level option, improve Config/Logger documentation, fix NETWORK_EANBLED typos in Engine
Tero Marttila <terom@fixme.fi>
parents:
417
diff
changeset
|
43 |
/** |
358 | 44 |
* --port |
45 |
*/ |
|
409
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
46 |
std::string net_port; |
358 | 47 |
|
48 |
/** |
|
49 |
* --server |
|
50 |
*/ |
|
409
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
51 |
bool net_server; |
358 | 52 |
|
53 |
/** |
|
54 |
* --connect |
|
55 |
*/ |
|
409
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
56 |
std::string net_connect; |
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
57 |
|
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
58 |
|
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
59 |
/** |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
60 |
* Set the arg_* members |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
61 |
* |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
62 |
* @return true if execution should proceed, false if execution should stop |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
63 |
*/ |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
64 |
bool parse_args (int argc, char **argv); |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
65 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
66 |
/** |
409
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
67 |
* Parse signed integer argument |
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
68 |
*/ |
409
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
69 |
int parse_arg_int (const std::string &arg_val, const char *arg_name); |
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
70 |
|
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
71 |
/** |
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
72 |
* Parse unsigned WIDTHxHEIGHT argument |
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
73 |
*/ |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
409
diff
changeset
|
74 |
PixelDimensions parse_arg_dimensions (const std::string &arg_val, const char *arg_name); |
418
194bc810a570
add --log-level option, improve Config/Logger documentation, fix NETWORK_EANBLED typos in Engine
Tero Marttila <terom@fixme.fi>
parents:
417
diff
changeset
|
75 |
|
194bc810a570
add --log-level option, improve Config/Logger documentation, fix NETWORK_EANBLED typos in Engine
Tero Marttila <terom@fixme.fi>
parents:
417
diff
changeset
|
76 |
/** |
194bc810a570
add --log-level option, improve Config/Logger documentation, fix NETWORK_EANBLED typos in Engine
Tero Marttila <terom@fixme.fi>
parents:
417
diff
changeset
|
77 |
* Parse a LogLevel |
194bc810a570
add --log-level option, improve Config/Logger documentation, fix NETWORK_EANBLED typos in Engine
Tero Marttila <terom@fixme.fi>
parents:
417
diff
changeset
|
78 |
*/ |
194bc810a570
add --log-level option, improve Config/Logger documentation, fix NETWORK_EANBLED typos in Engine
Tero Marttila <terom@fixme.fi>
parents:
417
diff
changeset
|
79 |
LogLevel parse_arg_loglevel (const std::string &arg_val, const char *arg_name); |
358 | 80 |
|
81 |
/** |
|
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
82 |
* Print out a list of display modes |
358 | 83 |
*/ |
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
84 |
void dump_display_modes (void); |
397
13fa0546ef87
hopefully version stuff is now run properly on every make...
Tero Marttila <terom@fixme.fi>
parents:
389
diff
changeset
|
85 |
|
13fa0546ef87
hopefully version stuff is now run properly on every make...
Tero Marttila <terom@fixme.fi>
parents:
389
diff
changeset
|
86 |
/** |
417
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
87 |
* Print out our project version and some configuration info |
397
13fa0546ef87
hopefully version stuff is now run properly on every make...
Tero Marttila <terom@fixme.fi>
parents:
389
diff
changeset
|
88 |
*/ |
13fa0546ef87
hopefully version stuff is now run properly on every make...
Tero Marttila <terom@fixme.fi>
parents:
389
diff
changeset
|
89 |
void dump_version (void); |
358 | 90 |
|
91 |
public: |
|
92 |
/** |
|
409
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
93 |
* Setup default values |
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
94 |
*/ |
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
95 |
Main (void); |
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
96 |
|
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
97 |
/** |
358 | 98 |
* IT BEGAN IN AFRIKA |
99 |
*/ |
|
100 |
virtual int main (int argc, char **argv); |
|
101 |
} app; |
|
102 |
||
103 |
#endif |