Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 6, 2008, 2:32:19 PM (17 years ago)
Author:
rgrieder
Message:
  • feature: Automatic key repetition in InputBuffer, configurable in orxonox.ini
  • replaced std::list and std::map with std::vector in InputManager where necessary
  • new mouseWheelTurned event
  • some renaming
  • OIS:: calls only necessary in InputManager now
Location:
code/branches/input/src/orxonox/objects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/input/src/orxonox/objects/SpaceShip.cc

    r1219 r1236  
    343343    }
    344344
    345     bool SpaceShip::mouseMoved(const OIS::MouseEvent &e)
     345    bool SpaceShip::mouseMoved(const MouseState& state)
    346346    {
    347347/*
     
    360360        if (this->bRMousePressed_)
    361361        {
    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;
    372372            if (this->mouseX_ < -minDimension)
    373373                this->mouseX_ = -minDimension;
     
    375375                this->mouseX_ = minDimension;
    376376
    377             this->mouseY_ += e.state.Y.rel;
     377            this->mouseY_ += state.Y.rel;
    378378            if (this->mouseY_ < -minDimension)
    379379                this->mouseY_ = -minDimension;
     
    403403    }
    404404
    405     bool SpaceShip::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id)
    406     {
    407         if (id == OIS::MB_Left)
     405    bool SpaceShip::mouseButtonPressed(const MouseState& state, MouseButton::Enum id)
     406    {
     407        if (id == MouseButton::Left)
    408408            this->bLMousePressed_ = true;
    409         else if (id == OIS::MB_Right)
     409        else if (id == MouseButton::Right)
    410410            this->bRMousePressed_ = true;
    411411
     
    413413    }
    414414
    415     bool SpaceShip::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id)
    416     {
    417         if (id == OIS::MB_Left)
     415    bool SpaceShip::mouseButtonReleased(const MouseState& state, MouseButton::Enum id)
     416    {
     417        if (id == MouseButton::Left)
    418418            this->bLMousePressed_ = false;
    419         else if (id == OIS::MB_Right)
     419        else if (id == MouseButton::Right)
    420420        {
    421421            this->bRMousePressed_ = false;
     
    453453            this->timeToReload_ = this->reloadTime_;
    454454        }
    455 
    456         OIS::Keyboard* mKeyboard = InputManager::getKeyboard();
    457455
    458456
     
    522520        }
    523521
    524         if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W))
     522        if (InputManager::isKeyDown(KeyCode::Up) || InputManager::isKeyDown(KeyCode::W))
    525523            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))
    527525            this->acceleration_.x = -this->translationAcceleration_;
    528526        else
    529527            this->acceleration_.x = 0;
    530528
    531         if (mKeyboard->isKeyDown(OIS::KC_RIGHT) || mKeyboard->isKeyDown(OIS::KC_D))
     529        if (InputManager::isKeyDown(KeyCode::Right) || InputManager::isKeyDown(KeyCode::D))
    532530            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))
    534532            this->acceleration_.y = this->translationAcceleration_;
    535533        else
    536534            this->acceleration_.y = 0;
    537535
    538         if (mKeyboard->isKeyDown(OIS::KC_DELETE) || mKeyboard->isKeyDown(OIS::KC_Q))
     536        if (InputManager::isKeyDown(KeyCode::Delete) || InputManager::isKeyDown(KeyCode::Q))
    539537            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))
    541539            this->momentum_ = Radian(this->rotationAccelerationRadian_);
    542540        else
  • code/branches/input/src/orxonox/objects/SpaceShip.h

    r1219 r1236  
    3434#include <OgrePrerequisites.h>
    3535
    36 #include "core/InputHandler.h"
     36#include "core/InputInterfaces.h"
    3737#include "Model.h"
    3838#include "../tools/BillboardSet.h"
     
    6565                { SpaceShip::instance_s->setMaxSpeed(value); }
    6666
    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; }
    7172
    7273
Note: See TracChangeset for help on using the changeset viewer.