Changeset 1535 for code/trunk/src/orxonox/Orxonox.cc
- Timestamp:
- Jun 4, 2008, 8:54:43 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/Orxonox.cc
r1534 r1535 21 21 * 22 22 * Author: 23 * Reto Grieder 24 * Co-authors: 23 25 * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007 24 * Co-authors:25 * ...26 26 * 27 27 */ … … 57 57 #include "core/Debug.h" 58 58 #include "core/Loader.h" 59 #include "core/Tickable.h" 60 #include "core/InputManager.h" 59 #include "core/input/InputManager.h" 61 60 #include "core/TclBind.h" 61 #include "core/Core.h" 62 62 63 63 // audio … … 70 70 // objects and tools 71 71 #include "hud/HUD.h" 72 #include <Ogre.h>72 #include "objects/Tickable.h" 73 73 74 74 #include "GraphicsEngine.h" 75 #include "Settings.h" 75 76 76 77 // FIXME: is this really file scope? 77 78 // globals for the server or client 78 network::Client *client_g ;79 network::Server *server_g ;79 network::Client *client_g = 0; 80 network::Server *server_g = 0; 80 81 81 82 namespace orxonox … … 166 167 * @param path path to config (in home dir or something) 167 168 */ 168 bool Orxonox::init(int argc, char **argv, std::string path) 169 { 170 //TODO: find config file (assuming executable directory) 171 //TODO: read config file 172 //TODO: give config file to Ogre 169 bool Orxonox::init(int argc, char **argv) 170 { 171 #ifdef _DEBUG 172 ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox_d.ini"); 173 #else 174 ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini"); 175 #endif 176 Factory::createClassHierarchy(); 177 173 178 std::string mode; 174 std::string dataPath;179 std::string tempDataPath; 175 180 176 181 ArgReader ar(argc, argv); 177 ar.checkArgument("mode", mode, false);178 ar.checkArgument("data", dataPath, false);179 ar.checkArgument("ip", serverIp_, false);180 ar.checkArgument("port", serverPort_, false);182 ar.checkArgument("mode", &mode, false); 183 ar.checkArgument("data", &tempDataPath, false); 184 ar.checkArgument("ip", &serverIp_, false); 185 ar.checkArgument("port", &serverPort_, false); 181 186 if(ar.errorHandling()) 187 { 188 COUT(1) << "Error while parsing command line arguments" << std::endl; 189 COUT(1) << ar.getErrorString(); 190 COUT(0) << "Usage:" << std::endl << "orxonox [mode client|server|dedicated|standalone] " 191 << "[--data PATH] [--ip IP] [--port PORT]" << std::endl; 182 192 return false; 193 } 183 194 184 195 if (mode == "client") … … 190 201 else 191 202 { 192 mode = "standalone"; 203 if (mode == "") 204 mode = "standalone"; 205 if (mode != "standalone") 206 { 207 COUT(2) << "Warning: mode \"" << mode << "\" doesn't exist. " 208 << "Defaulting to standalone" << std::endl; 209 mode = "standalone"; 210 } 193 211 mode_ = STANDALONE; 194 212 } 195 213 COUT(3) << "Orxonox: Mode is " << mode << "." << std::endl; 214 215 if (tempDataPath != "") 216 { 217 if (tempDataPath[tempDataPath.size() - 1] != '/') 218 tempDataPath += "/"; 219 Settings::tsetDataPath(tempDataPath); 220 } 221 222 // initialise TCL 223 TclBind::getInstance().setDataPath(Settings::getDataPath()); 196 224 197 225 //if (mode_ == DEDICATED) … … 202 230 // procedure until the GUI is identical 203 231 204 ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");205 Factory::createClassHierarchy();206 207 232 ogre_ = &GraphicsEngine::getSingleton(); 208 if (!ogre_->setup( path)) // creates ogre root and other essentials233 if (!ogre_->setup()) // creates ogre root and other essentials 209 234 return false; 210 235 … … 421 446 } 422 447 448 // tick the core 449 Core::tick((float)evt.timeSinceLastFrame); 423 450 // Call those objects that need the real time 424 451 for (Iterator<TickableReal> it = ObjectList<TickableReal>::start(); it; ++it) … … 427 454 for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) 428 455 it->tick((float)evt.timeSinceLastFrame * this->timefactor_); 456 //AudioManager::tick(); 457 if (client_g) 458 client_g->tick((float)evt.timeSinceLastFrame); 459 if (server_g) 460 server_g->tick((float)evt.timeSinceLastFrame); 429 461 430 462 // don't forget to call _fireFrameStarted in ogre to make sure
Note: See TracChangeset
for help on using the changeset viewer.