Changeset 1236 for code/branches/input/src/orxonox
- Timestamp:
- May 6, 2008, 2:32:19 PM (17 years ago)
- Location:
- code/branches/input/src/orxonox/objects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/input/src/orxonox/objects/SpaceShip.cc
r1219 r1236 343 343 } 344 344 345 bool SpaceShip::mouseMoved(const OIS::MouseEvent &e)345 bool SpaceShip::mouseMoved(const MouseState& state) 346 346 { 347 347 /* … … 360 360 if (this->bRMousePressed_) 361 361 { 362 this->camNode_->roll(Degree(- e.state.X.rel * 0.10));363 this->camNode_->yaw(Degree( e.state.Y.rel * 0.10));364 } 365 else 366 { 367 float minDimension = e.state.height;368 if ( e.state.width < minDimension)369 minDimension = e.state.width;370 371 this->mouseX_ += e.state.X.rel;362 this->camNode_->roll(Degree(-state.X.rel * 0.10)); 363 this->camNode_->yaw(Degree(state.Y.rel * 0.10)); 364 } 365 else 366 { 367 float minDimension = state.height; 368 if (state.width < minDimension) 369 minDimension = state.width; 370 371 this->mouseX_ += state.X.rel; 372 372 if (this->mouseX_ < -minDimension) 373 373 this->mouseX_ = -minDimension; … … 375 375 this->mouseX_ = minDimension; 376 376 377 this->mouseY_ += e.state.Y.rel;377 this->mouseY_ += state.Y.rel; 378 378 if (this->mouseY_ < -minDimension) 379 379 this->mouseY_ = -minDimension; … … 403 403 } 404 404 405 bool SpaceShip::mouse Pressed(const OIS::MouseEvent &e, OIS::MouseButtonIDid)406 { 407 if (id == OIS::MB_Left)405 bool SpaceShip::mouseButtonPressed(const MouseState& state, MouseButton::Enum id) 406 { 407 if (id == MouseButton::Left) 408 408 this->bLMousePressed_ = true; 409 else if (id == OIS::MB_Right)409 else if (id == MouseButton::Right) 410 410 this->bRMousePressed_ = true; 411 411 … … 413 413 } 414 414 415 bool SpaceShip::mouse Released(const OIS::MouseEvent &e, OIS::MouseButtonIDid)416 { 417 if (id == OIS::MB_Left)415 bool SpaceShip::mouseButtonReleased(const MouseState& state, MouseButton::Enum id) 416 { 417 if (id == MouseButton::Left) 418 418 this->bLMousePressed_ = false; 419 else if (id == OIS::MB_Right)419 else if (id == MouseButton::Right) 420 420 { 421 421 this->bRMousePressed_ = false; … … 453 453 this->timeToReload_ = this->reloadTime_; 454 454 } 455 456 OIS::Keyboard* mKeyboard = InputManager::getKeyboard();457 455 458 456 … … 522 520 } 523 521 524 if ( mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W))522 if (InputManager::isKeyDown(KeyCode::Up) || InputManager::isKeyDown(KeyCode::W)) 525 523 this->acceleration_.x = this->translationAcceleration_; 526 else if( mKeyboard->isKeyDown(OIS::KC_DOWN) || mKeyboard->isKeyDown(OIS::KC_S))524 else if(InputManager::isKeyDown(KeyCode::Down) || InputManager::isKeyDown(KeyCode::S)) 527 525 this->acceleration_.x = -this->translationAcceleration_; 528 526 else 529 527 this->acceleration_.x = 0; 530 528 531 if ( mKeyboard->isKeyDown(OIS::KC_RIGHT) || mKeyboard->isKeyDown(OIS::KC_D))529 if (InputManager::isKeyDown(KeyCode::Right) || InputManager::isKeyDown(KeyCode::D)) 532 530 this->acceleration_.y = -this->translationAcceleration_; 533 else if ( mKeyboard->isKeyDown(OIS::KC_LEFT) || mKeyboard->isKeyDown(OIS::KC_A))531 else if (InputManager::isKeyDown(KeyCode::Left) || InputManager::isKeyDown(KeyCode::A)) 534 532 this->acceleration_.y = this->translationAcceleration_; 535 533 else 536 534 this->acceleration_.y = 0; 537 535 538 if ( mKeyboard->isKeyDown(OIS::KC_DELETE) || mKeyboard->isKeyDown(OIS::KC_Q))536 if (InputManager::isKeyDown(KeyCode::Delete) || InputManager::isKeyDown(KeyCode::Q)) 539 537 this->momentum_ = Radian(-this->rotationAccelerationRadian_); 540 else if ( mKeyboard->isKeyDown(OIS::KC_PGDOWN) || mKeyboard->isKeyDown(OIS::KC_E))538 else if (InputManager::isKeyDown(KeyCode::PageDown) || InputManager::isKeyDown(KeyCode::E)) 541 539 this->momentum_ = Radian(this->rotationAccelerationRadian_); 542 540 else -
code/branches/input/src/orxonox/objects/SpaceShip.h
r1219 r1236 34 34 #include <OgrePrerequisites.h> 35 35 36 #include "core/Input Handler.h"36 #include "core/InputInterfaces.h" 37 37 #include "Model.h" 38 38 #include "../tools/BillboardSet.h" … … 65 65 { SpaceShip::instance_s->setMaxSpeed(value); } 66 66 67 bool mouseMoved(const OIS::MouseEvent &e); 68 bool mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id); 69 bool mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id); 70 bool mouseHeld(const OIS::MouseEvent &e, OIS::MouseButtonID id) { return true; } 67 bool mouseButtonPressed (const MouseState& state, MouseButton::Enum id); 68 bool mouseButtonReleased(const MouseState& state, MouseButton::Enum id); 69 bool mouseButtonHeld (const MouseState& state, MouseButton::Enum id) { return true; } 70 bool mouseMoved (const MouseState& state); 71 bool mouseWheelTurned (const MouseState& state) { return true; } 71 72 72 73
Note: See TracChangeset
for help on using the changeset viewer.