Changeset 519 for code/branches/FICN/src/orxonox
- Timestamp:
- Dec 13, 2007, 6:45:17 PM (17 years ago)
- Location:
- code/branches/FICN/src/orxonox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/orxonox/objects/SpaceshipSteeringObject.cc
r515 r519 54 54 steering->addNode(sceneNode); 55 55 56 57 58 56 59 std::cout << "Loader: Initialized spaceship steering at node " << nodeStr << " values "<< forward << " " << rotateupdown << " "<< rotaterightleft << " "<< looprightleft << " "<< std::endl << std::endl; 57 60 } -
code/branches/FICN/src/orxonox/orxonox.cc
r515 r519 80 80 { 81 81 public: 82 OrxListener(OIS::Keyboard *keyboard, OIS::Mouse *mouse, audio::AudioManager* auMan )82 OrxListener(OIS::Keyboard *keyboard, OIS::Mouse *mouse, audio::AudioManager* auMan, SpaceshipSteering* steering) 83 83 : mKeyboard(keyboard), mMouse(mouse) 84 84 { 85 85 86 SpaceshipSteering* steering = orxonox::Orxonox::getSingleton()->getSteeringPointer();86 87 87 88 88 speed = 250; … … 94 94 minMouseX = 0; 95 95 moved = false; 96 steering->brakeRotate(rotate*10); 97 steering->brakeLoop(loop); 96 97 steering_ = steering; 98 99 steering_->brakeRotate(rotate*10); 100 steering_->brakeLoop(loop); 101 102 98 103 mMouse->setEventCallback(this); 99 104 auMan_ = auMan; … … 104 109 auMan_->update(); 105 110 106 SpaceshipSteering* steering = orxonox::Orxonox::getSingleton()->getSteeringPointer();107 108 111 mKeyboard->capture(); 109 112 mMouse->capture(); 110 113 if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W)) 111 steering ->moveForward(speed);114 steering_->moveForward(speed); 112 115 else 113 steering ->moveForward(0);116 steering_->moveForward(0); 114 117 if(mKeyboard->isKeyDown(OIS::KC_DOWN) || mKeyboard->isKeyDown(OIS::KC_S)) 115 steering ->brakeForward(speed);118 steering_->brakeForward(speed); 116 119 else 117 steering ->brakeForward(speed/10);120 steering_->brakeForward(speed/10); 118 121 if (mKeyboard->isKeyDown(OIS::KC_RIGHT) || mKeyboard->isKeyDown(OIS::KC_D)) 119 steering ->loopRight(loop);122 steering_->loopRight(loop); 120 123 else 121 steering ->loopRight(0);124 steering_->loopRight(0); 122 125 if (mKeyboard->isKeyDown(OIS::KC_LEFT) || mKeyboard->isKeyDown(OIS::KC_A)) 123 steering ->loopLeft(loop);126 steering_->loopLeft(loop); 124 127 else 125 steering ->loopLeft(0);128 steering_->loopLeft(0); 126 129 127 130 if(moved) { 128 131 if (mouseY<=0) 129 steering ->rotateUp(-mouseY*rotate);132 steering_->rotateUp(-mouseY*rotate); 130 133 if (mouseY>0) 131 steering ->rotateDown(mouseY*rotate);134 steering_->rotateDown(mouseY*rotate); 132 135 if (mouseX>0) 133 steering ->rotateRight(mouseX*rotate);136 steering_->rotateRight(mouseX*rotate); 134 137 if (mouseX<=0) 135 steering ->rotateLeft(-mouseX*rotate);138 steering_->rotateLeft(-mouseX*rotate); 136 139 mouseY = 0; 137 140 mouseX = 0; … … 139 142 } 140 143 else { 141 steering ->rotateUp(0);142 steering ->rotateDown(0);143 steering ->rotateRight(0);144 steering ->rotateLeft(0);144 steering_->rotateUp(0); 145 steering_->rotateDown(0); 146 steering_->rotateRight(0); 147 steering_->rotateLeft(0); 145 148 } 146 149 147 steering ->tick(evt.timeSinceLastFrame);150 steering_->tick(evt.timeSinceLastFrame); 148 151 149 152 … … 181 184 OIS::Mouse *mMouse; 182 185 audio::AudioManager* auMan_; 186 SpaceshipSteering* steering_; 183 187 }; 184 188 // init static singleton reference of Orxonox … … 444 448 ogre_->getRoot()->addFrameListener(TimerFL); 445 449 446 frameListener_ = new OrxListener(keyboard_, mouse_, auMan_ );450 frameListener_ = new OrxListener(keyboard_, mouse_, auMan_, steering_); 447 451 ogre_->getRoot()->addFrameListener(frameListener_); 448 452 }
Note: See TracChangeset
for help on using the changeset viewer.