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.
25 #include "SDLBackend.h"
27 #include "OpenALBackend.h"
30 #include "qtgui/QtBackend.h"
37 // SDL tries stealing main on some platforms, which we don't want.
40 extern "C" int main(int argc
, char *argv
[]) {
44 version
= "development build";
46 version
= RELEASE_VERSION
;
48 std::cout
<< "openc2e (" << version
<< "), built " __DATE__
" " __TIME__
"\nCopyright (c) 2004-2008 "
49 "Alyssa Milburn and others\n\n";
51 engine
.addPossibleBackend("sdl", shared_ptr
<Backend
>(new SDLBackend()));
53 boost::shared_ptr
<QtBackend
> qtbackend
= boost::shared_ptr
<QtBackend
>(new QtBackend());
54 boost::shared_ptr
<Backend
> qtbackend_generic
= boost::dynamic_pointer_cast
<class Backend
, class QtBackend
>(qtbackend
);
55 engine
.addPossibleBackend("qt", qtbackend_generic
); // last-added backend is default
58 engine
.addPossibleAudioBackend("openal", shared_ptr
<AudioBackend
>(new OpenALBackend()));
61 // pass command-line flags to the engine, but do no other setup
62 if (!engine
.parseCommandLine(argc
, argv
)) return 1;
64 // get the engine to do all the startup (read catalogue, loading world, etc)
65 if (!engine
.initialSetup()) return 0;
67 int ret
= engine
.backend
->run(argc
, argv
);
69 // we're done, be sure to shut stuff down
73 } catch (std::exception
&e
) {
75 MessageBox(NULL
, e
.what(), "openc2e - Fatal exception encountered:", MB_ICONERROR
);
77 std::cerr
<< "Fatal exception encountered: " << e
.what() << "\n";