Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/Main.cc @ 2003

Last change on this file since 2003 was 1896, checked in by rgrieder, 16 years ago

In msvc files:

  • linked lua and tolua statically to toluagen and toluagen_orxonox
  • created output directories for different versions and builds

Update your msvc dependencies!

  • Property svn:eol-style set to native
File size: 3.3 KB
RevLine 
[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"
[1891]41#include "util/Debug.h"
42#include "core/ConfigFileManager.h"
[1747]43#include "SignalHandler.h"
[612]44
[1755]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
[612]54using namespace orxonox;
[1755]55
[1021]56#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
[612]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{
[1755]64    char path[1024];
65    CFBundleRef mainBundle = CFBundleGetMainBundle();
66    assert(mainBundle);
[612]67
[1755]68    CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
69    assert(mainBundleURL);
[612]70
[1755]71    CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);
72    assert(cfStringRef);
[612]73
[1755]74    CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);
[612]75
[1755]76    CFRelease(mainBundleURL);
77    CFRelease(cfStringRef);
[612]78
[1755]79    return std::string(path);
[612]80}
81#endif
82
83
[1755]84//#ifdef __cplusplus
85//extern "C" {
86//#endif
87
88int main(int argc, char** argv)
[622]89{
[1755]90    // create a signal handler (only works for linux)
[612]91    SignalHandler::getInstance()->doCatch(argv[0], "orxonox.log");
[1021]92
[1891]93    // Specifiy config file before creating the GameStates in order to have
94    // setConfigValues() in the constructor (required).
[1896]95    ConfigFileManager::getInstance().setFile(CFT_Settings, "orxonox.ini");
[1891]96
97    // create the gamestates
[1755]98    GSRoot root;
99    GSGraphics graphics;
100    GSStandalone standalone;
101    GSServer server;
102    GSClient client;
103    GSDedicated dedicated;
104    GSGUI gui;
105    GSIOConsole ioConsole;
[612]106
[1891]107    // make the hierarchy
[1755]108    root.addChild(&graphics);
109    graphics.addChild(&standalone);
110    graphics.addChild(&server);
111    graphics.addChild(&client);
112    graphics.addChild(&gui);
113    root.addChild(&ioConsole);
114    root.addChild(&dedicated);
115
[1891]116    // Here happens the game
[1755]117    root.start(argc, argv);
118
119    return 0;
[612]120}
121
[1755]122//#ifdef __cplusplus
123//}
124//#endif
Note: See TracBrowser for help on using the repository browser.