author | Tero Marttila <terom@fixme.fi> |
Tue, 13 Jan 2009 21:36:43 +0200 | |
changeset 392 | 6c4dc68360eb |
parent 389 | e74c1820fbd2 |
child 397 | 13fa0546ef87 |
permissions | -rw-r--r-- |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
1 |
|
358 | 2 |
#include "Application.hh" |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
3 |
|
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
4 |
#include <stdexcept> |
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
5 |
#include <cstdio> |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
6 |
#include <cassert> |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
7 |
|
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
8 |
enum ArgumentCodes { |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
9 |
ARG_HELP = 'h', |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
10 |
ARG_PORT = 'p', |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
11 |
ARG_SERVER = 's', |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
12 |
ARG_CLIENT = 'c', |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
13 |
ARG_GRAPHICS = 'g', |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
14 |
ARG_FULLSCREEN = 'F', |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
15 |
ARG_RESOLUTION = 'R', |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
16 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
17 |
ARG_LIST_MODES = 0xff01, |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
18 |
}; |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
19 |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
20 |
|
358 | 21 |
/** |
22 |
* Set the arg_* members |
|
23 |
*/ |
|
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
24 |
bool Main::parse_args (int argc, char **argv) { |
358 | 25 |
// set up the options |
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
26 |
args.add_option(ARG_HELP, "help", "", |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
27 |
"display argument help and exit"); |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
28 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
29 |
args.add_option(ARG_PORT, "port", "PORT", |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
30 |
"set network port used"); |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
31 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
32 |
args.add_option(ARG_SERVER, "server", "", |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
33 |
"act as a network server"); |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
34 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
35 |
args.add_option(ARG_CLIENT, "client", "SERVERHOST", |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
36 |
"act as a network client"); |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
37 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
38 |
args.add_option(ARG_GRAPHICS, "graphics", "", |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
39 |
"run graphics/local input. Implied with --connect"); |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
40 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
41 |
args.add_option(ARG_FULLSCREEN, "fullscreen", "", |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
42 |
"run graphics in fullscreen mode"); |
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 |
args.add_option(ARG_RESOLUTION, "resolution", "WIDTHxHEIGHT", |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
45 |
"set graphics resolution"); |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
46 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
47 |
args.add_option(ARG_LIST_MODES, "list-modes", "", |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
48 |
"output a list of available display modes and exit"); |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
49 |
|
358 | 50 |
// set defaults |
51 |
arg_graphics = false; |
|
52 |
arg_port = NETWORK_PORT_STR; |
|
53 |
arg_server = false; |
|
54 |
arg_connect = ""; |
|
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
55 |
arg_fullscreen = GRAPHICS_FULLSCREEN; |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
56 |
arg_resolution = PixelCoordinate(GRAPHICS_RESOLUTION_WIDTH, GRAPHICS_RESOLUTION_HEIGHT); |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
57 |
|
358 | 58 |
// extra state |
392
6c4dc68360eb
remove unused graphics_default, and default to the highest resolution available in fullscreen mode
Tero Marttila <terom@fixme.fi>
parents:
389
diff
changeset
|
59 |
bool resolution_default = true; |
358 | 60 |
|
61 |
try { |
|
62 |
// parse args |
|
63 |
args.parse_args(argc, argv); |
|
267 | 64 |
|
358 | 65 |
} catch (CL_Error &e) { |
66 |
throw ArgumentError(e.message); |
|
67 |
} |
|
267 | 68 |
|
358 | 69 |
while (args.next()) { |
70 |
switch (args.get_key()) { |
|
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
71 |
case ARG_HELP: |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
72 |
args.print_help(); |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
73 |
return false; |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
74 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
75 |
case ARG_PORT: |
358 | 76 |
arg_port = args.get_argument(); |
77 |
break; |
|
78 |
||
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
79 |
case ARG_SERVER: |
358 | 80 |
arg_server = true; |
81 |
break; |
|
82 |
||
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
83 |
case ARG_CLIENT: |
358 | 84 |
arg_connect = args.get_argument(); |
85 |
break; |
|
86 |
||
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
87 |
case ARG_GRAPHICS: |
267 | 88 |
arg_graphics = true; |
358 | 89 |
break; |
90 |
||
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
91 |
case ARG_FULLSCREEN: |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
92 |
arg_fullscreen = true; |
392
6c4dc68360eb
remove unused graphics_default, and default to the highest resolution available in fullscreen mode
Tero Marttila <terom@fixme.fi>
parents:
389
diff
changeset
|
93 |
|
6c4dc68360eb
remove unused graphics_default, and default to the highest resolution available in fullscreen mode
Tero Marttila <terom@fixme.fi>
parents:
389
diff
changeset
|
94 |
// choose best resolution unless explicitly set |
6c4dc68360eb
remove unused graphics_default, and default to the highest resolution available in fullscreen mode
Tero Marttila <terom@fixme.fi>
parents:
389
diff
changeset
|
95 |
if (resolution_default) { |
6c4dc68360eb
remove unused graphics_default, and default to the highest resolution available in fullscreen mode
Tero Marttila <terom@fixme.fi>
parents:
389
diff
changeset
|
96 |
const CL_DisplayMode best_mode = Graphics::getBestMode(); |
6c4dc68360eb
remove unused graphics_default, and default to the highest resolution available in fullscreen mode
Tero Marttila <terom@fixme.fi>
parents:
389
diff
changeset
|
97 |
const CL_Size best_resolution = best_mode.get_resolution(); |
6c4dc68360eb
remove unused graphics_default, and default to the highest resolution available in fullscreen mode
Tero Marttila <terom@fixme.fi>
parents:
389
diff
changeset
|
98 |
|
6c4dc68360eb
remove unused graphics_default, and default to the highest resolution available in fullscreen mode
Tero Marttila <terom@fixme.fi>
parents:
389
diff
changeset
|
99 |
arg_resolution = PixelCoordinate(best_resolution.width, best_resolution.height); |
6c4dc68360eb
remove unused graphics_default, and default to the highest resolution available in fullscreen mode
Tero Marttila <terom@fixme.fi>
parents:
389
diff
changeset
|
100 |
} |
6c4dc68360eb
remove unused graphics_default, and default to the highest resolution available in fullscreen mode
Tero Marttila <terom@fixme.fi>
parents:
389
diff
changeset
|
101 |
|
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
102 |
break; |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
103 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
104 |
case ARG_RESOLUTION: |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
105 |
parse_arg_resolution(args.get_argument()); |
392
6c4dc68360eb
remove unused graphics_default, and default to the highest resolution available in fullscreen mode
Tero Marttila <terom@fixme.fi>
parents:
389
diff
changeset
|
106 |
resolution_default = false; |
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
107 |
break; |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
108 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
109 |
case ARG_LIST_MODES: |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
110 |
dump_display_modes(); |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
111 |
return false; |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
112 |
|
358 | 113 |
case CL_CommandLine::REST_ARG: |
114 |
throw ArgumentError(args.get_argument()); |
|
115 |
||
116 |
default: |
|
117 |
throw ArgumentError(std::string(1, (char) args.get_key())); |
|
118 |
||
119 |
} |
|
120 |
} |
|
121 |
||
122 |
// check for invalid combinations of arugments |
|
123 |
if (arg_server and !arg_connect.empty()) |
|
124 |
throw ArgumentError("cannot be both server and client"); |
|
125 |
||
126 |
// enable graphics by default unless server |
|
392
6c4dc68360eb
remove unused graphics_default, and default to the highest resolution available in fullscreen mode
Tero Marttila <terom@fixme.fi>
parents:
389
diff
changeset
|
127 |
if (!arg_server) |
358 | 128 |
arg_graphics = true; |
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
129 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
130 |
// continue |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
131 |
return true; |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
132 |
} |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
133 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
134 |
void Main::parse_arg_resolution (const std::string &val) { |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
135 |
unsigned int w, h; |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
136 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
137 |
// sccanf as unsigned |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
138 |
if (sscanf(val.c_str(), "%ux%u", &w, &h) != 2) |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
139 |
throw ArgumentError("invalid format for --resolution"); |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
140 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
141 |
// store as PixelCoordinate |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
142 |
arg_resolution = PixelCoordinate(w, h); |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
143 |
} |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
144 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
145 |
void Main::dump_display_modes (void) { |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
146 |
const std::vector<CL_DisplayMode> &modes = Graphics::getDisplayModes(); |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
147 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
148 |
std::cout << "Available display modes:" << std::endl; |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
149 |
|
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
150 |
for (std::vector<CL_DisplayMode>::const_iterator it = modes.begin(); it != modes.end(); it++) |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
151 |
std::cout << "\t" << it->get_resolution().width << "x" << it->get_resolution().height << std::endl; |
358 | 152 |
} |
153 |
||
154 |
/** |
|
155 |
* IT BEGAN IN AFRIKA |
|
156 |
*/ |
|
157 |
int Main::main (int argc, char **argv) { |
|
158 |
// initialize the ClanLib components that we use |
|
159 |
CL_SetupCore setup_core; |
|
160 |
CL_SetupNetwork setup_network; |
|
161 |
CL_SetupDisplay setup_disp; |
|
162 |
CL_SetupGL setup_gl; |
|
163 |
||
164 |
try { |
|
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
165 |
// parse arugments, exit if false |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
166 |
if (parse_args(argc, argv) == false) |
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
167 |
return 0; |
358 | 168 |
|
169 |
// our engine |
|
170 |
Engine engine; |
|
171 |
||
172 |
// setup graphics |
|
173 |
if (arg_graphics) |
|
389
e74c1820fbd2
implement --help, --fullscreen, --resolution and --list-modes
Tero Marttila <terom@fixme.fi>
parents:
358
diff
changeset
|
174 |
engine.setupGraphics(arg_resolution, arg_fullscreen); |
358 | 175 |
|
176 |
// setup either network server, client or singleplayer |
|
177 |
if (arg_server) { |
|
178 |
engine.setupNetworkServer(arg_port); |
|
179 |
||
180 |
} else if (!arg_connect.empty()) { |
|
181 |
engine.setupNetworkClient(arg_connect, arg_port); |
|
182 |
||
183 |
} else { |
|
184 |
engine.setupSinglePlayer(); |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
185 |
} |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
186 |
|
358 | 187 |
// run the main loop |
188 |
engine.run(); |
|
189 |
||
190 |
// succesful return |
|
191 |
return 0; |
|
192 |
||
193 |
} catch (ArgumentError &e) { |
|
194 |
std::cerr << e.what() << std::endl; |
|
195 |
args.print_help(); |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
196 |
|
358 | 197 |
// XXX: handle --help |
198 |
return 1; |
|
199 |
} catch (CL_Error &e) { |
|
200 |
std::cerr << "main: CL_Error:" << e.message << std::endl; |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
201 |
|
358 | 202 |
return 1; |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
203 |
|
358 | 204 |
} catch (std::exception &e) { |
205 |
std::cerr << "FATAL [uncaught_exception] " << e.what() << std::endl; |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
206 |
|
358 | 207 |
return 1; |
208 |
} |
|
209 |
} |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
210 |