Changeset 1755 for code/trunk/src/orxonox/Main.cc
- Timestamp:
- Sep 10, 2008, 1:37:36 AM (17 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/gui (added) merged: 1636,1638,1640-1647,1649-1654,1656,1659-1665,1670,1672-1674,1686,1688-1692,1694-1697,1704 /code/branches/input (added) merged: 1629-1630
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/Main.cc
r1747 r1755 22 22 * Author: 23 23 * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007 24 * Reto Grieder 24 25 * Co-authors: 25 26 * ... … … 35 36 36 37 #include <exception> 38 #include <cassert> 37 39 38 40 #include "util/OrxonoxPlatform.h" 39 41 #include "SignalHandler.h" 40 #include "Orxonox.h" 42 #include "util/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/GSDedicated.h" 50 #include "gamestates/GSGUI.h" 51 #include "gamestates/GSIOConsole.h" 41 52 42 53 using namespace orxonox; 54 43 55 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE 44 56 #include <CoreFoundation/CoreFoundation.h> … … 49 61 std::string macBundlePath() 50 62 { 51 char path[1024];52 CFBundleRef mainBundle = CFBundleGetMainBundle();53 assert(mainBundle);63 char path[1024]; 64 CFBundleRef mainBundle = CFBundleGetMainBundle(); 65 assert(mainBundle); 54 66 55 CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);56 assert(mainBundleURL);67 CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle); 68 assert(mainBundleURL); 57 69 58 CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);59 assert(cfStringRef);70 CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle); 71 assert(cfStringRef); 60 72 61 CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);73 CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII); 62 74 63 CFRelease(mainBundleURL);64 CFRelease(cfStringRef);75 CFRelease(mainBundleURL); 76 CFRelease(cfStringRef); 65 77 66 return std::string(path);78 return std::string(path); 67 79 } 68 80 #endif 69 81 70 #ifdef __cplusplus71 extern "C" {72 #endif73 82 74 int main(int argc, char **argv) 83 //#ifdef __cplusplus 84 //extern "C" { 85 //#endif 86 87 int main(int argc, char** argv) 75 88 { 76 //try {89 // create a signal handler (only works for linux) 77 90 SignalHandler::getInstance()->doCatch(argv[0], "orxonox.log"); 78 Orxonox* orx = Orxonox::getSingleton();79 91 80 bool res = false; 81 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE 82 res = orx->init(argc, argv, macBundlePath()); 83 #else 84 res = orx->init(argc, argv); 85 #endif 92 GSRoot root; 93 GSGraphics graphics; 94 GSStandalone standalone; 95 GSServer server; 96 GSClient client; 97 GSDedicated dedicated; 98 GSGUI gui; 99 GSIOConsole ioConsole; 86 100 87 if (res) 88 orx->start(); 89 orx->destroySingleton(); 90 /*} 91 catch (std::exception &ex) 92 { 93 std::cerr << "Exception:\n"; 94 std::cerr << ex.what() << "\n"; 95 return 1; 96 }*/ 101 root.addChild(&graphics); 102 graphics.addChild(&standalone); 103 graphics.addChild(&server); 104 graphics.addChild(&client); 105 graphics.addChild(&gui); 97 106 98 return 0; 107 root.addChild(&ioConsole); 108 root.addChild(&dedicated); 109 110 root.start(argc, argv); 111 112 return 0; 99 113 } 100 114 101 #ifdef __cplusplus102 }103 #endif115 //#ifdef __cplusplus 116 //} 117 //#endif
Note: See TracChangeset
for help on using the changeset viewer.