Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 1958 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
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    ConfigFileManager::getInstance().setFile(CFT_Settings, "orxonox.ini");
96
97    // create the gamestates
98    GSRoot root;
99    GSGraphics graphics;
100    GSStandalone standalone;
101    GSServer server;
102    GSClient client;
103    GSDedicated dedicated;
104    GSGUI gui;
105    GSIOConsole ioConsole;
106
107    // make the hierarchy
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
116    // Here happens the game
117    root.start(argc, argv);
118
119    return 0;
120}
121
122//#ifdef __cplusplus
123//}
124//#endif
Note: See TracBrowser for help on using the repository browser.