[612] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
[1293] | 3 | * > www.orxonox.net < |
---|
[612] | 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 |
---|
[1755] | 24 | * Reto Grieder |
---|
[612] | 25 | * Co-authors: |
---|
| 26 | * ... |
---|
| 27 | * |
---|
| 28 | */ |
---|
| 29 | |
---|
| 30 | /** |
---|
[1021] | 31 | @file |
---|
| 32 | @brief Entry point of the program. Platform specific code. |
---|
[612] | 33 | */ |
---|
| 34 | |
---|
[1293] | 35 | #include "OrxonoxStableHeaders.h" |
---|
[612] | 36 | |
---|
[1293] | 37 | #include <exception> |
---|
[1755] | 38 | #include <cassert> |
---|
[1293] | 39 | |
---|
[1502] | 40 | #include "util/OrxonoxPlatform.h" |
---|
[1747] | 41 | #include "SignalHandler.h" |
---|
[1755] | 42 | #include "util/Debug.h" |
---|
[612] | 43 | |
---|
[1755] | 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/GSDedicated.h" |
---|
| 50 | #include "gamestates/GSGUI.h" |
---|
| 51 | #include "gamestates/GSIOConsole.h" |
---|
| 52 | |
---|
[612] | 53 | using namespace orxonox; |
---|
[1755] | 54 | |
---|
[1021] | 55 | #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE |
---|
[612] | 56 | #include <CoreFoundation/CoreFoundation.h> |
---|
| 57 | |
---|
| 58 | // This function will locate the path to our application on OS X, |
---|
| 59 | // unlike windows you can not rely on the curent working directory |
---|
| 60 | // for locating your configuration files and resources. |
---|
| 61 | std::string macBundlePath() |
---|
| 62 | { |
---|
[1755] | 63 | char path[1024]; |
---|
| 64 | CFBundleRef mainBundle = CFBundleGetMainBundle(); |
---|
| 65 | assert(mainBundle); |
---|
[612] | 66 | |
---|
[1755] | 67 | CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle); |
---|
| 68 | assert(mainBundleURL); |
---|
[612] | 69 | |
---|
[1755] | 70 | CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle); |
---|
| 71 | assert(cfStringRef); |
---|
[612] | 72 | |
---|
[1755] | 73 | CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII); |
---|
[612] | 74 | |
---|
[1755] | 75 | CFRelease(mainBundleURL); |
---|
| 76 | CFRelease(cfStringRef); |
---|
[612] | 77 | |
---|
[1755] | 78 | return std::string(path); |
---|
[612] | 79 | } |
---|
| 80 | #endif |
---|
| 81 | |
---|
| 82 | |
---|
[1755] | 83 | //#ifdef __cplusplus |
---|
| 84 | //extern "C" { |
---|
| 85 | //#endif |
---|
| 86 | |
---|
| 87 | int main(int argc, char** argv) |
---|
[622] | 88 | { |
---|
[1755] | 89 | // create a signal handler (only works for linux) |
---|
[612] | 90 | SignalHandler::getInstance()->doCatch(argv[0], "orxonox.log"); |
---|
[1021] | 91 | |
---|
[1755] | 92 | GSRoot root; |
---|
| 93 | GSGraphics graphics; |
---|
| 94 | GSStandalone standalone; |
---|
| 95 | GSServer server; |
---|
| 96 | GSClient client; |
---|
| 97 | GSDedicated dedicated; |
---|
| 98 | GSGUI gui; |
---|
| 99 | GSIOConsole ioConsole; |
---|
[612] | 100 | |
---|
[1755] | 101 | root.addChild(&graphics); |
---|
| 102 | graphics.addChild(&standalone); |
---|
| 103 | graphics.addChild(&server); |
---|
| 104 | graphics.addChild(&client); |
---|
| 105 | graphics.addChild(&gui); |
---|
[612] | 106 | |
---|
[1755] | 107 | root.addChild(&ioConsole); |
---|
| 108 | root.addChild(&dedicated); |
---|
| 109 | |
---|
| 110 | root.start(argc, argv); |
---|
| 111 | |
---|
| 112 | return 0; |
---|
[612] | 113 | } |
---|
| 114 | |
---|
[1755] | 115 | //#ifdef __cplusplus |
---|
| 116 | //} |
---|
| 117 | //#endif |
---|