| [462] | 1 | /* | 
|---|
 | 2 |  *   ORXONOX - the hottest 3D action shooter ever to exist | 
|---|
 | 3 |  * | 
|---|
 | 4 |  * | 
|---|
 | 5 |  *   License notice: | 
|---|
 | 6 |  * | 
|---|
 | 7 |  *   This program is free software; you can redistribute it and/or | 
|---|
 | 8 |  *   modify it under the terms of the GNU General Public License | 
|---|
 | 9 |  *   as published by the Free Software Foundation; either version 2 | 
|---|
 | 10 |  *   of the License, or (at your option) any later version. | 
|---|
 | 11 |  * | 
|---|
 | 12 |  *   This program is distributed in the hope that it will be useful, | 
|---|
 | 13 |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
 | 14 |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
 | 15 |  *   GNU General Public License for more details. | 
|---|
 | 16 |  * | 
|---|
 | 17 |  *   You should have received a copy of the GNU General Public License | 
|---|
 | 18 |  *   along with this program; if not, write to the Free Software | 
|---|
 | 19 |  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | 
|---|
 | 20 |  * | 
|---|
 | 21 |  *   Author: | 
|---|
 | 22 |  *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007 | 
|---|
 | 23 |  *   Co-authors: | 
|---|
 | 24 |  *      ... | 
|---|
 | 25 |  * | 
|---|
 | 26 |  */ | 
|---|
 | 27 |  | 
|---|
 | 28 |  /** | 
|---|
 | 29 |  @file  main.cc | 
|---|
 | 30 |  @brief main file handling most of the machine specific code | 
|---|
 | 31 |   */ | 
|---|
 | 32 |  | 
|---|
 | 33 | #include <OgrePlatform.h> | 
|---|
 | 34 | #include <OgreException.h> | 
|---|
 | 35 |  | 
|---|
 | 36 |  | 
|---|
| [496] | 37 | #include "core/SignalHandler.h" | 
|---|
| [462] | 38 | #include "orxonox.h" | 
|---|
 | 39 |  | 
|---|
 | 40 | using namespace orxonox; | 
|---|
 | 41 | using namespace Ogre; | 
|---|
 | 42 | #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE | 
|---|
 | 43 | #include <CoreFoundation/CoreFoundation.h> | 
|---|
 | 44 |  | 
|---|
 | 45 | // This function will locate the path to our application on OS X, | 
|---|
 | 46 | // unlike windows you can not rely on the curent working directory | 
|---|
 | 47 | // for locating your configuration files and resources. | 
|---|
 | 48 |              std::string macBundlePath() | 
|---|
 | 49 | { | 
|---|
 | 50 |   char path[1024]; | 
|---|
 | 51 |   CFBundleRef mainBundle = CFBundleGetMainBundle(); | 
|---|
 | 52 |   assert(mainBundle); | 
|---|
 | 53 |  | 
|---|
 | 54 |   CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle); | 
|---|
 | 55 |   assert(mainBundleURL); | 
|---|
 | 56 |  | 
|---|
 | 57 |   CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle); | 
|---|
 | 58 |   assert(cfStringRef); | 
|---|
 | 59 |  | 
|---|
 | 60 |   CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII); | 
|---|
 | 61 |  | 
|---|
 | 62 |   CFRelease(mainBundleURL); | 
|---|
 | 63 |   CFRelease(cfStringRef); | 
|---|
 | 64 |  | 
|---|
 | 65 |   return std::string(path); | 
|---|
 | 66 | } | 
|---|
 | 67 | #endif | 
|---|
 | 68 |  | 
|---|
| [496] | 69 | int main(int argc, char **argv) | 
|---|
| [462] | 70 | { | 
|---|
 | 71 |   try | 
|---|
 | 72 |   { | 
|---|
| [496] | 73 |     SignalHandler::getInstance()->doCatch(argv[0], "orxonox.log"); | 
|---|
| [462] | 74 |     Orxonox* orx = Orxonox::getSingleton(); | 
|---|
 | 75 | #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE | 
|---|
 | 76 |     orx->init(argc, argv, macBundlePath()); | 
|---|
| [473] | 77 |     //orx->start(); | 
|---|
| [462] | 78 | #else | 
|---|
 | 79 |     orx->init(argc, argv, ""); | 
|---|
| [473] | 80 |     //orx->start(); | 
|---|
| [462] | 81 | #endif | 
|---|
 | 82 |  | 
|---|
 | 83 |   } | 
|---|
 | 84 |   catch(Ogre::Exception& e) | 
|---|
 | 85 |   { | 
|---|
 | 86 |     fprintf(stderr, "An exception has occurred: %s\n", | 
|---|
 | 87 |             e.getFullDescription().c_str()); | 
|---|
 | 88 |     return 1; | 
|---|
 | 89 |   } | 
|---|
 | 90 |  | 
|---|
 | 91 |   return 0; | 
|---|
 | 92 | } | 
|---|
 | 93 |  | 
|---|