1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
4 | * |
---|
5 | * |
---|
6 | * License notice: |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU General Public License |
---|
10 | * as published by the Free Software Foundation; either version 2 |
---|
11 | * of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | * |
---|
22 | * Author: |
---|
23 | * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007 |
---|
24 | * Reto Grieder |
---|
25 | * Co-authors: |
---|
26 | * ... |
---|
27 | * |
---|
28 | */ |
---|
29 | |
---|
30 | /** |
---|
31 | @file |
---|
32 | @brief Entry point of the program. Platform specific code. |
---|
33 | */ |
---|
34 | |
---|
35 | #include "OrxonoxStableHeaders.h" |
---|
36 | |
---|
37 | #include <exception> |
---|
38 | #include <cassert> |
---|
39 | |
---|
40 | #include "util/OrxonoxPlatform.h" |
---|
41 | #include "core/SignalHandler.h" |
---|
42 | #include "core/Debug.h" |
---|
43 | |
---|
44 | #include "gamestates/GSRoot.h" |
---|
45 | #include "gamestates/GSGraphics.h" |
---|
46 | #include "gamestates/GSStandalone.h" |
---|
47 | #include "gamestates/GSServer.h" |
---|
48 | #include "gamestates/GSClient.h" |
---|
49 | #include "gamestates/GSGUI.h" |
---|
50 | #include "gamestates/GSIOConsole.h" |
---|
51 | |
---|
52 | using namespace orxonox; |
---|
53 | |
---|
54 | #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE |
---|
55 | #include <CoreFoundation/CoreFoundation.h> |
---|
56 | |
---|
57 | // This function will locate the path to our application on OS X, |
---|
58 | // unlike windows you can not rely on the curent working directory |
---|
59 | // for locating your configuration files and resources. |
---|
60 | std::string macBundlePath() |
---|
61 | { |
---|
62 | char path[1024]; |
---|
63 | CFBundleRef mainBundle = CFBundleGetMainBundle(); |
---|
64 | assert(mainBundle); |
---|
65 | |
---|
66 | CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle); |
---|
67 | assert(mainBundleURL); |
---|
68 | |
---|
69 | CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle); |
---|
70 | assert(cfStringRef); |
---|
71 | |
---|
72 | CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII); |
---|
73 | |
---|
74 | CFRelease(mainBundleURL); |
---|
75 | CFRelease(cfStringRef); |
---|
76 | |
---|
77 | return std::string(path); |
---|
78 | } |
---|
79 | #endif |
---|
80 | |
---|
81 | |
---|
82 | //#ifdef __cplusplus |
---|
83 | //extern "C" { |
---|
84 | //#endif |
---|
85 | |
---|
86 | int main(int argc, char** argv) |
---|
87 | { |
---|
88 | // create a signal handler (only works for linux) |
---|
89 | SignalHandler::getInstance()->doCatch(argv[0], "orxonox.log"); |
---|
90 | |
---|
91 | GSRoot root; |
---|
92 | GSGraphics graphics; |
---|
93 | GSStandalone standalone; |
---|
94 | GSServer server; |
---|
95 | GSClient client; |
---|
96 | GSGUI gui; |
---|
97 | GSIOConsole ioConsole; |
---|
98 | |
---|
99 | root.addChild(&graphics); |
---|
100 | graphics.addChild(&standalone); |
---|
101 | graphics.addChild(&server); |
---|
102 | graphics.addChild(&client); |
---|
103 | graphics.addChild(&gui); |
---|
104 | |
---|
105 | root.addChild(&ioConsole); |
---|
106 | |
---|
107 | root.start(argc, argv); |
---|
108 | |
---|
109 | return 0; |
---|
110 | } |
---|
111 | |
---|
112 | //#ifdef __cplusplus |
---|
113 | //} |
---|
114 | //#endif |
---|