Changeset 473 for code/branches/FICN/src/orxonox/orxonox.cc
- Timestamp:
- Dec 12, 2007, 6:11:30 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/orxonox/orxonox.cc
r469 r473 63 63 #include "../network/Server.h" 64 64 #include "../network/Client.h" 65 //#include "../network/NetworkFrameListener.h"65 #include "../network/NetworkFrameListener.h" 66 66 67 67 // some tests to see if enet works without includsion … … 222 222 // load this file from config 223 223 string levelFile = "sample.oxw"; 224 loader_ = new loader::LevelLoader(levelFile);224 //loader_ = new loader::LevelLoader(levelFile); 225 225 //TODO: run engine 226 226 } … … 248 248 ogre_->setConfigPath(path); 249 249 ogre_->setup(); 250 if(!ogre_->load()) die(/* unable to load */); 251 } 252 253 void Orxonox::serverInit(std::string path) 254 { 255 ogre_->setConfigPath(path); 256 ogre_->setup(); 257 //server_g = new network::Server(); // add some settings if wanted 258 if(!ogre_->load()) die(/* unable to load */); 259 //ogre_->getRoot()->addFrameListener(new network::ServerFrameListener()); 260 ogre_->startRender(); 261 262 createScene(); 263 setupScene(); 264 } 265 266 void Orxonox::clientInit(std::string path) 267 { 268 ogre_->setConfigPath(path); 269 ogre_->setup(); 270 //client_g = new network::Client(); // address here 271 if(!ogre_->load()) die(/* unable to load */); 272 //ogre_->getRoot()->addFrameListener(new network::ClientFrameListener()); 273 ogre_->startRender(); 274 250 root_ = ogre_->getRoot(); 251 //if(!ogre_->load()) die(/* unable to load */); 252 253 defineResources(); 254 setupRenderSystem(); 255 createRenderWindow(); 256 initializeResourceGroups(); 275 257 createScene(); 276 258 setupScene(); … … 278 260 createFrameListener(); 279 261 startRenderLoop(); 262 } 263 264 void Orxonox::serverInit(std::string path) 265 { 266 ogre_->setConfigPath(path); 267 ogre_->setup(); 268 server_g = new network::Server(); // add some settings if wanted 269 if(!ogre_->load()) die(/* unable to load */); 270 //ogre_->getRoot()->addFrameListener(new network::ServerFrameListener()); 271 ogre_->startRender(); 272 273 createScene(); 274 setupScene(); 275 } 276 277 void Orxonox::clientInit(std::string path) 278 { 279 ogre_->setConfigPath(path); 280 ogre_->setup(); 281 client_g = new network::Client(); // address here 282 if(!ogre_->load()) die(/* unable to load */); 283 //ogre_->getRoot()->addFrameListener(new network::ClientFrameListener()); 284 ogre_->startRender(); 285 286 createScene(); 287 setupScene(); 288 setupInputSystem(); 289 createFrameListener(); 290 startRenderLoop(); 291 } 292 293 void Orxonox::defineResources() 294 { 295 Ogre::String secName, typeName, archName; 296 Ogre::ConfigFile cf; 297 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE 298 cf.load(macBundlePath() + "/Contents/Resources/resources.cfg"); 299 #else 300 cf.load("resources.cfg"); 301 #endif 302 303 Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator(); 304 while (seci.hasMoreElements()) 305 { 306 secName = seci.peekNextKey(); 307 Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext(); 308 Ogre::ConfigFile::SettingsMultiMap::iterator i; 309 for (i = settings->begin(); i != settings->end(); ++i) 310 { 311 typeName = i->first; 312 archName = i->second; 313 #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE 314 Ogre::ResourceGroupManager::getSingleton().addResourceLocation( String(macBundlePath() + "/" + archName), typeName, secName); 315 #else 316 Ogre::ResourceGroupManager::getSingleton().addResourceLocation( archName, typeName, secName); 317 #endif 318 } 319 } 320 } 321 322 void Orxonox::setupRenderSystem() 323 { 324 if (!root_->restoreConfig() && !root_->showConfigDialog()) 325 throw Exception(52, "User canceled the config dialog!", "OrxApplication::setupRenderSystem()"); 326 } 327 328 void Orxonox::createRenderWindow() 329 { 330 root_->initialise(true, "OrxonoxV2"); 331 } 332 333 void Orxonox::initializeResourceGroups() 334 { 335 TextureManager::getSingleton().setDefaultNumMipmaps(5); 336 ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); 280 337 } 281 338
Note: See TracChangeset
for help on using the changeset viewer.