Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 2, 2008, 9:31:20 PM (16 years ago)
Author:
rgrieder
Message:
  • SpaceShip is now a default listener for mouse input. still a hack..
  • several changes in InputManager.cc regarding joy sticks
  • Key bindings work, but not very advanced
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/input/src/core/InputHandler.h

    r1213 r1215  
    4040#include "ois/OIS.h"
    4141#include "OrxonoxClass.h"
     42#include "CommandExecutor.h"
    4243
    4344namespace orxonox
     
    6061  {
    6162  public:
     63    virtual ~KeyHandler() { }
    6264    virtual bool keyHeld(const OIS::KeyEvent &arg) = 0;
    6365  };
     
    6971  {
    7072  public:
     73    virtual ~MouseHandler() { }
    7174    virtual bool mouseHeld(const OIS::MouseEvent &arg, OIS::MouseButtonID id) = 0;
    7275  };
     
    7578    @brief Interface class used for joy stick input listeners.
    7679  */
    77   class _CoreExport JoyStickHandler : public OIS::JoyStickListener
    78   {
    79   public:
    80     virtual bool buttonHeld(const OIS::JoyStickEvent &arg, int button) = 0;
     80  class _CoreExport JoyStickHandler
     81  {
     82  public:
     83    virtual ~JoyStickHandler() { }
     84                virtual bool buttonPressed (int joyStickID, const OIS::JoyStickEvent &arg, int button) = 0;
     85                virtual bool buttonReleased(int joyStickID, const OIS::JoyStickEvent &arg, int button) = 0;
     86    virtual bool buttonHeld    (int joyStickID, const OIS::JoyStickEvent &arg, int button) = 0;
     87                virtual bool axisMoved     (int joyStickID, const OIS::JoyStickEvent &arg, int axis)   = 0;
     88                virtual bool sliderMoved   (int joyStickID, const OIS::JoyStickEvent &arg, int index) {return true;}
     89                virtual bool povMoved      (int joyStickID, const OIS::JoyStickEvent &arg, int index) {return true;}
     90                virtual bool vector3Moved  (int joyStickID, const OIS::JoyStickEvent &arg, int index) {return true;}
     91  };
     92
     93  struct _CoreExport KeyBinding
     94  {
     95    std::string commandStr;
     96    CommandEvaluation evaluation;
    8197  };
    8298 
     
    100116
    101117  private: // functions
     118
     119    bool executeBinding(KeyBinding &binding);
     120
    102121                bool keyPressed   (const OIS::KeyEvent   &arg);
    103122                bool keyReleased  (const OIS::KeyEvent   &arg);
     
    109128    bool mouseMoved   (const OIS::MouseEvent &arg);
    110129
    111                 bool buttonPressed (const OIS::JoyStickEvent &arg, int button);
    112                 bool buttonReleased(const OIS::JoyStickEvent &arg, int button);
    113                 bool buttonHeld    (const OIS::JoyStickEvent &arg, int button);
    114                 bool axisMoved     (const OIS::JoyStickEvent &arg, int axis);
    115                 bool sliderMoved   (const OIS::JoyStickEvent &arg, int id);
    116                 bool povMoved      (const OIS::JoyStickEvent &arg, int id);
     130                bool buttonPressed (int joyStickID, const OIS::JoyStickEvent &arg, int button);
     131                bool buttonReleased(int joyStickID, const OIS::JoyStickEvent &arg, int button);
     132                bool buttonHeld    (int joyStickID, const OIS::JoyStickEvent &arg, int button);
     133                bool axisMoved     (int joyStickID, const OIS::JoyStickEvent &arg, int axis);
     134                bool sliderMoved   (int joyStickID, const OIS::JoyStickEvent &arg, int id);
     135                bool povMoved      (int joyStickID, const OIS::JoyStickEvent &arg, int id);
     136                bool vector3Moved  (int joyStickID, const OIS::JoyStickEvent &arg, int id);
    117137
    118138  private: // variables
     
    121141    static const int numberOfKeys_s = 0xEE;
    122142    //! Array of input events for every pressed key
    123     std::string bindingsKeyPress_  [numberOfKeys_s];
     143    KeyBinding bindingsKeyPress_  [numberOfKeys_s];
    124144    //! Array of input events for every released key
    125     std::string bindingsKeyRelease_[numberOfKeys_s];
     145    KeyBinding bindingsKeyRelease_[numberOfKeys_s];
    126146    //! Array of input events for every held key
    127     std::string bindingsKeyHold_   [numberOfKeys_s];
     147    KeyBinding bindingsKeyHold_   [numberOfKeys_s];
    128148    //! Names of the keys as strings
    129149    std::string keyNames_[numberOfKeys_s];
Note: See TracChangeset for help on using the changeset viewer.