Changeset 599 for code/branches/FICN/src/orxonox/orxonox.cc
- Timestamp:
- Dec 17, 2007, 9:56:47 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/orxonox/orxonox.cc
r592 r599 226 226 //TODO: give config file to Ogre 227 227 std::string mode; 228 if(argc>=2)229 mode = std::string(argv[1]);230 else231 mode = "";228 // if(argc>=2) 229 // mode = std::string(argv[1]); 230 // else 231 // mode = ""; 232 232 ArgReader ar = ArgReader(argc, argv); 233 233 ar.checkArgument("mode", mode, false); 234 234 ar.checkArgument("data", this->dataPath_, false); 235 ar.checkArgument("ip", serverIp_, false); 235 236 if(ar.errorHandling()) die(); 236 237 … … 238 239 { 239 240 serverInit(path); 240 mode = SERVER;241 mode_ = SERVER; 241 242 } 242 243 else if(mode == std::string("client")) 243 244 { 244 245 clientInit(path); 245 mode = CLIENT;246 mode_ = CLIENT; 246 247 } 247 248 else if(mode == std::string("presentation")) 248 249 { 249 250 serverInit(path); 250 mode = PRESENTATION;251 mode_ = PRESENTATION; 251 252 } 252 253 else{ 253 254 standaloneInit(path); 254 mode = STANDALONE;255 mode_ = STANDALONE; 255 256 } 256 257 } … … 267 268 setupScene(); 268 269 setupInputSystem(); 270 if(mode_!=CLIENT){ // remove this in future ---- presentation hack 271 } 272 else 273 std::cout << "client here" << std::endl; 269 274 createFrameListener(); 270 275 Factory::createClassHierarchy(); … … 273 278 server_g->open(); 274 279 break; 280 case CLIENT: 281 client_g->establishConnection(); 282 break; 275 283 case SERVER: 276 case CLIENT:277 284 case STANDALONE: 278 285 default: … … 356 363 void Orxonox::serverInit(std::string path) 357 364 { 365 COUT(2) << "initialising server" << std::endl; 358 366 ogre_->setConfigPath(path); 359 367 ogre_->setup(); … … 366 374 void Orxonox::clientInit(std::string path) 367 375 { 376 COUT(2) << "initialising client" << std::endl; 368 377 ogre_->setConfigPath(path); 369 378 ogre_->setup(); 370 client_g = new network::Client(); // address here 379 if(serverIp_.compare("")==0) 380 client_g = new network::Client(); 381 else 382 client_g = new network::Client(serverIp_, 55556); 371 383 if(!ogre_->load()) die(/* unable to load */); 372 384 ogre_->getRoot()->addFrameListener(new network::ClientFrameListener()); … … 523 535 ogre_->getRoot()->addFrameListener(TimerFL); 524 536 525 frameListener_ = new OrxListener(keyboard_, mouse_, auMan_, steering_); 537 //if(mode_!=CLIENT) // just a hack ------- remove this in future 538 frameListener_ = new OrxListener(keyboard_, mouse_, auMan_, steering_); 526 539 ogre_->getRoot()->addFrameListener(frameListener_); 527 540 } … … 536 549 ogre_->getRoot()->getAutoCreatedWindow()->getMetrics(width, height, depth, left, top); 537 550 538 const OIS::MouseState &ms = mouse_->getMouseState(); 539 ms.width = width; 540 ms.height = height; 541 551 if(mode_!=CLIENT){ 552 const OIS::MouseState &ms = mouse_->getMouseState(); 553 ms.width = width; 554 ms.height = height; 555 } 542 556 ogre_->getRoot()->startRendering(); 543 557 }
Note: See TracChangeset
for help on using the changeset viewer.