author | Tero Marttila <terom@fixme.fi> |
Tue, 13 Jan 2009 23:54:47 +0200 | |
changeset 394 | 82def222fe7d |
parent 389 | e74c1820fbd2 |
child 397 | 13fa0546ef87 |
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 |
*/ |
|
26 |
bool arg_graphics; |
|
27 |
||
28 |
/** |
|
29 |
* --port |
|
30 |
*/ |
|
31 |
std::string arg_port; |
|
32 |
||
33 |
/** |
|
34 |
* --server |
|
35 |
*/ |
|
36 |
bool arg_server; |
|
37 |
||
38 |
/** |
|
39 |
* --connect |
|
40 |
*/ |
|
41 |
std::string arg_connect; |
|
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
42 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
43 |
/** |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
44 |
* --fullscreen |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
45 |
*/ |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
46 |
bool arg_fullscreen; |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
47 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
48 |
/** |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
49 |
* --resolution |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
50 |
*/ |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
51 |
PixelCoordinate arg_resolution; |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
52 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
53 |
/** |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
54 |
* Set the arg_* members |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
55 |
* |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
56 |
* @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
|
57 |
*/ |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
58 |
bool parse_args (int argc, char **argv); |
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 |
/** |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
61 |
* Parse and set --resolution/arg_resolution WIDTHxHEIGHT |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
62 |
*/ |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
63 |
void parse_arg_resolution (const std::string &val); |
358 | 64 |
|
65 |
/** |
|
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
66 |
* Print out a list of display modes |
358 | 67 |
*/ |
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
68 |
void dump_display_modes (void); |
358 | 69 |
|
70 |
public: |
|
71 |
/** |
|
72 |
* IT BEGAN IN AFRIKA |
|
73 |
*/ |
|
74 |
virtual int main (int argc, char **argv); |
|
75 |
} app; |
|
76 |
||
77 |
#endif |