Changeset 1184 for code/branches/network3/src/orxonox
- Timestamp:
- Apr 24, 2008, 11:00:30 PM (17 years ago)
- Location:
- code/branches/network3/src/orxonox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network3/src/orxonox/Orxonox.cc
r1174 r1184 184 184 GraphicsEngine::getSingleton().destroy(); 185 185 186 if ( client_g)187 delete client_g;186 if (network::Client::getSingleton()) 187 network::Client::destroySingleton(); 188 188 if (server_g) 189 189 delete server_g; … … 281 281 ogre_->setup(); 282 282 if(serverIp_.compare("")==0) 283 client_g = ne w network::Client();283 client_g = network::Client::createSingleton(); 284 284 else 285 client_g = ne w network::Client(serverIp_, NETWORK_PORT);285 client_g = network::Client::createSingleton(serverIp_, NETWORK_PORT); 286 286 if(!ogre_->load(this->dataPath_)) abortImmediateForce(/* unable to load */); 287 287 } … … 422 422 ib->registerListener(console, &Testconsole::execute, '\n', false); 423 423 ib->registerListener(console, &Testconsole::hintandcomplete, '\t', true); 424 ib->registerListener(console, &Testconsole::clear, ' §', true);424 ib->registerListener(console, &Testconsole::clear, '�', true); 425 425 ib->registerListener(console, &Testconsole::removeLast, '\b', true); 426 426 ib->registerListener(console, &Testconsole::exit, (char)0x1B, true); -
code/branches/network3/src/orxonox/objects/SpaceShip.cc
r1180 r1184 50 50 #include "core/XMLPort.h" 51 51 #include "core/ConsoleCommand.h" 52 #include "network/Client.h" 52 53 53 54 namespace orxonox … … 165 166 void SpaceShip::init() 166 167 { 168 createCamera(); 167 169 // START CREATING THRUSTER 168 170 this->tt_ = new ParticleInterface(GraphicsEngine::getSingleton().getSceneManager(),"twinthruster" + this->getName(),"Orxonox/engineglow"); … … 281 283 void SpaceShip::setCamera(const std::string& camera) 282 284 { 283 Ogre::Camera *cam = GraphicsEngine::getSingleton().getSceneManager()->createCamera("ShipCam"); 284 this->camNode_ = this->getNode()->createChildSceneNode("CamNode"); 285 // change camera attributes here, if you want to ;) 286 } 287 288 void SpaceShip::createCamera(){ 289 Ogre::Camera *cam = GraphicsEngine::getSingleton().getSceneManager()->createCamera("ShipCam"); 290 this->camNode_ = this->getNode()->createChildSceneNode("CamNode"); 285 291 /* 286 292 // node->setInheritOrientation(false); 287 288 289 290 */ 291 292 293 cam->setPosition(Vector3(0,50,-150)); 294 cam->lookAt(Vector3(0,20,0)); 295 cam->roll(Degree(0)); 296 */ 297 298 cam->setPosition(Vector3(-200,0,35)); 293 299 // cam->setPosition(Vector3(0,-350,0)); 294 cam->lookAt(Vector3(0,0,35)); 295 cam->roll(Degree(-90)); 296 297 this->camNode_->attachObject(cam); 298 GraphicsEngine::getSingleton().getRenderWindow()->addViewport(cam); 300 cam->lookAt(Vector3(0,0,35)); 301 cam->roll(Degree(-90)); 302 303 this->camNode_->attachObject(cam); 304 GraphicsEngine::getSingleton().getRenderWindow()->addViewport(cam); 305 299 306 } 300 307 … … 427 434 void SpaceShip::tick(float dt) 428 435 { 429 if (InputManager::getSingleton().getMouse()->getEventCallback() != this) 436 // only do this if not client TODO: remove this hack 437 if (!network::Client::getSingleton() && InputManager::getSingleton().getMouse()->getEventCallback() != this) 430 438 { 431 439 if (InputManager::getSingleton().getMouse()) … … 526 534 } 527 535 528 if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W)) 529 this->acceleration_.x = this->translationAcceleration_; 530 else if(mKeyboard->isKeyDown(OIS::KC_DOWN) || mKeyboard->isKeyDown(OIS::KC_S)) 531 this->acceleration_.x = -this->translationAcceleration_; 532 else 533 this->acceleration_.x = 0; 534 535 if (mKeyboard->isKeyDown(OIS::KC_RIGHT) || mKeyboard->isKeyDown(OIS::KC_D)) 536 this->acceleration_.y = -this->translationAcceleration_; 537 else if (mKeyboard->isKeyDown(OIS::KC_LEFT) || mKeyboard->isKeyDown(OIS::KC_A)) 538 this->acceleration_.y = this->translationAcceleration_; 539 else 540 this->acceleration_.y = 0; 541 542 if (mKeyboard->isKeyDown(OIS::KC_DELETE) || mKeyboard->isKeyDown(OIS::KC_Q)) 543 this->momentum_ = Radian(-this->rotationAccelerationRadian_); 544 else if (mKeyboard->isKeyDown(OIS::KC_PGDOWN) || mKeyboard->isKeyDown(OIS::KC_E)) 545 this->momentum_ = Radian(this->rotationAccelerationRadian_); 546 else 547 this->momentum_ = 0; 536 if(!network::Client::getSingleton()){ 537 if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W)) 538 this->acceleration_.x = this->translationAcceleration_; 539 else if(mKeyboard->isKeyDown(OIS::KC_DOWN) || mKeyboard->isKeyDown(OIS::KC_S)) 540 this->acceleration_.x = -this->translationAcceleration_; 541 else 542 this->acceleration_.x = 0; 543 544 if (mKeyboard->isKeyDown(OIS::KC_RIGHT) || mKeyboard->isKeyDown(OIS::KC_D)) 545 this->acceleration_.y = -this->translationAcceleration_; 546 else if (mKeyboard->isKeyDown(OIS::KC_LEFT) || mKeyboard->isKeyDown(OIS::KC_A)) 547 this->acceleration_.y = this->translationAcceleration_; 548 else 549 this->acceleration_.y = 0; 550 551 if (mKeyboard->isKeyDown(OIS::KC_DELETE) || mKeyboard->isKeyDown(OIS::KC_Q)) 552 this->momentum_ = Radian(-this->rotationAccelerationRadian_); 553 else if (mKeyboard->isKeyDown(OIS::KC_PGDOWN) || mKeyboard->isKeyDown(OIS::KC_E)) 554 this->momentum_ = Radian(this->rotationAccelerationRadian_); 555 else 556 this->momentum_ = 0; 557 } 548 558 549 559 WorldEntity::tick(dt); -
code/branches/network3/src/orxonox/objects/SpaceShip.h
r1056 r1184 71 71 72 72 private: 73 void createCamera(); 73 74 static SpaceShip* instance_s; 74 75 -
code/branches/network3/src/orxonox/objects/WorldEntity.cc
r1174 r1184 216 216 registerVar( (void*) &(this->getRotationAxis().y), sizeof(this->getRotationAxis().y), network::DATA); 217 217 registerVar( (void*) &(this->getRotationAxis().z), sizeof(this->getRotationAxis().z), network::DATA); 218 219 registerVar( (void*) &(this->getScale().x), sizeof(this->getScale().x), network::DATA); 220 registerVar( (void*) &(this->getScale().y), sizeof(this->getScale().y), network::DATA); 221 registerVar( (void*) &(this->getScale().z), sizeof(this->getScale().z), network::DATA); 218 222 } 219 223
Note: See TracChangeset
for help on using the changeset viewer.