5 * Created by Alyssa Milburn on Wed 02 Jun 2004.
6 * Copyright (c) 2004-2008 Alyssa Milburn. All rights reserved.
7 * Copyright (c) 2005-2008 Bryan Donlan. All rights reserved.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
24 #include "SDLBackend.h"
26 #include "OpenALBackend.h"
29 #include "qtgui/QtBackend.h"
36 // SDL tries stealing main on some platforms, which we don't want.
39 extern "C" int main(int argc
, char *argv
[]) {
41 std::cout
<< "openc2e (development build), built " __DATE__
" " __TIME__
"\nCopyright (c) 2004-2008 Alyssa Milburn and others\n\n";
43 engine
.addPossibleBackend("sdl", shared_ptr
<Backend
>(new SDLBackend()));
45 boost::shared_ptr
<QtBackend
> qtbackend
= boost::shared_ptr
<QtBackend
>(new QtBackend());
46 boost::shared_ptr
<Backend
> qtbackend_generic
= boost::dynamic_pointer_cast
<class Backend
, class QtBackend
>(qtbackend
);
47 engine
.addPossibleBackend("qt", qtbackend_generic
); // last-added backend is default
50 engine
.addPossibleAudioBackend("openal", shared_ptr
<AudioBackend
>(new OpenALBackend()));
53 // pass command-line flags to the engine, but do no other setup
54 if (!engine
.parseCommandLine(argc
, argv
)) return 1;
56 // get the engine to do all the startup (read catalogue, loading world, etc)
57 if (!engine
.initialSetup()) return 0;
59 int ret
= engine
.backend
->run(argc
, argv
);
61 // we're done, be sure to shut stuff down
65 } catch (std::exception
&e
) {
67 MessageBox(NULL
, e
.what(), "openc2e - Fatal exception encountered:", MB_ICONERROR
);
69 std::cerr
<< "Fatal exception encountered: " << e
.what() << "\n";