Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/questsystem/src/orxonox/Main.cc @ 1929

Last change on this file since 1929 was 1891, checked in by rgrieder, 16 years ago

Moved all Ogre related code from GSRoot to GSGraphics.
You should now be able to start the gui, goto ioConsole, then start the gui again and load the level.
gui —> level —> gui doesn't yet work. But I will not dig into that until our object hierarchy has been replaced.

  • Property svn:eol-style set to native
File size: 3.4 KB
Line 
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 "util/Debug.h"
42#include "core/ConfigFileManager.h"
43#include "SignalHandler.h"
44
45#include "gamestates/GSRoot.h"
46#include "gamestates/GSGraphics.h"
47#include "gamestates/GSStandalone.h"
48#include "gamestates/GSServer.h"
49#include "gamestates/GSClient.h"
50#include "gamestates/GSDedicated.h"
51#include "gamestates/GSGUI.h"
52#include "gamestates/GSIOConsole.h"
53
54using namespace orxonox;
55
56#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
57#include <CoreFoundation/CoreFoundation.h>
58
59// This function will locate the path to our application on OS X,
60// unlike windows you can not rely on the curent working directory
61// for locating your configuration files and resources.
62             std::string macBundlePath()
63{
64    char path[1024];
65    CFBundleRef mainBundle = CFBundleGetMainBundle();
66    assert(mainBundle);
67
68    CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
69    assert(mainBundleURL);
70
71    CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);
72    assert(cfStringRef);
73
74    CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);
75
76    CFRelease(mainBundleURL);
77    CFRelease(cfStringRef);
78
79    return std::string(path);
80}
81#endif
82
83
84//#ifdef __cplusplus
85//extern "C" {
86//#endif
87
88int main(int argc, char** argv)
89{
90    // create a signal handler (only works for linux)
91    SignalHandler::getInstance()->doCatch(argv[0], "orxonox.log");
92
93    // Specifiy config file before creating the GameStates in order to have
94    // setConfigValues() in the constructor (required).
95#if ORXONOX_DEBUG_MODE == 1
96        ConfigFileManager::getInstance().setFile(CFT_Settings, "orxonox_d.ini");
97#else
98        ConfigFileManager::getInstance().setFile(CFT_Settings, "orxonox.ini");
99#endif
100
101    // create the gamestates
102    GSRoot root;
103    GSGraphics graphics;
104    GSStandalone standalone;
105    GSServer server;
106    GSClient client;
107    GSDedicated dedicated;
108    GSGUI gui;
109    GSIOConsole ioConsole;
110
111    // make the hierarchy
112    root.addChild(&graphics);
113    graphics.addChild(&standalone);
114    graphics.addChild(&server);
115    graphics.addChild(&client);
116    graphics.addChild(&gui);
117    root.addChild(&ioConsole);
118    root.addChild(&dedicated);
119
120    // Here happens the game
121    root.start(argc, argv);
122
123    return 0;
124}
125
126//#ifdef __cplusplus
127//}
128//#endif
Note: See TracBrowser for help on using the repository browser.