Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 14, 2008, 11:44:17 AM (16 years ago)
Author:
rgrieder
Message:

merged input branch into merge branch

File:
1 edited

Legend:

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

    r1219 r1272  
    3838
    3939#include <string>
     40
    4041#include "ois/OIS.h"
    4142#include "OrxonoxClass.h"
    4243#include "CommandExecutor.h"
     44#include "InputInterfaces.h"
    4345
    4446namespace orxonox
     
    5456    };
    5557  }
    56 
    57   /**
    58     @brief Interface class used for key input listeners.
    59   */
    60   class _CoreExport KeyHandler : public OIS::KeyListener
    61   {
    62   public:
    63     virtual ~KeyHandler() { }
    64     virtual bool keyHeld(const OIS::KeyEvent &arg) = 0;
    65   };
    66 
    67   /**
    68     @brief Interface class used for mouse input listeners.
    69   */
    70   class _CoreExport MouseHandler : public OIS::MouseListener
    71   {
    72   public:
    73     virtual ~MouseHandler() { }
    74     virtual bool mouseHeld(const OIS::MouseEvent &arg, OIS::MouseButtonID id) = 0;
    75   };
    76 
    77   /**
    78     @brief Interface class used for joy stick input listeners.
    79   */
    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   };
    9258
    9359  struct _CoreExport KeyBinding
     
    11379    void setConfigValues();
    11480
    115     std::string testtest;
    116 
    11781  private: // functions
    11882
    119     bool executeBinding(KeyBinding &binding);
     83    bool executeSimpleBinding(KeyBinding &binding);
    12084
    121                 bool keyPressed   (const OIS::KeyEvent   &arg);
    122                 bool keyReleased  (const OIS::KeyEvent   &arg);
    123                 bool keyHeld      (const OIS::KeyEvent   &arg);
     85    bool keyPressed (const KeyEvent& evt);
     86    bool keyReleased(const KeyEvent& evt);
     87    bool keyHeld    (const KeyEvent& evt);
    12488
    125     bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButtonID id);
    126                 bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id);
    127                 bool mouseHeld    (const OIS::MouseEvent &arg, OIS::MouseButtonID id);
    128     bool mouseMoved   (const OIS::MouseEvent &arg);
     89    bool mouseButtonPressed (const MouseState& state, MouseButton::Enum id);
     90    bool mouseButtonReleased(const MouseState& state, MouseButton::Enum id);
     91    bool mouseButtonHeld    (const MouseState& state, MouseButton::Enum id);
     92    bool mouseMoved         (const MouseState& state);
     93    bool mouseScrolled      (const MouseState& state);
    12994
    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);
     95    bool joyStickButtonPressed (const JoyStickState& state, int button);
     96    bool joyStickButtonReleased(const JoyStickState& state, int button);
     97    bool joyStickButtonHeld    (const JoyStickState& state, int button);
     98    bool joyStickAxisMoved     (const JoyStickState& state, int axis)  ;
     99    bool joyStickSliderMoved   (const JoyStickState& state, int index) ;
     100    bool joyStickPovMoved      (const JoyStickState& state, int index) ;
     101    bool joyStickVector3Moved  (const JoyStickState& state, int index) ;
    137102
    138103  private: // variables
     
    152117    static const int numberOfMouseButtons_s = 8;
    153118    //! Array of input events for every pressed mouse button
    154     std::string bindingsMouseButtonPress_  [numberOfMouseButtons_s];
     119    KeyBinding bindingsMouseButtonPress_  [numberOfMouseButtons_s];
    155120    //! Array of input events for every released mouse button
    156     std::string bindingsMouseButtonRelease_[numberOfMouseButtons_s];
     121    KeyBinding bindingsMouseButtonRelease_[numberOfMouseButtons_s];
    157122    //! Array of input events for every held mouse button
    158     std::string bindingsMouseButtonHold_   [numberOfMouseButtons_s];
     123    KeyBinding bindingsMouseButtonHold_   [numberOfMouseButtons_s];
     124    //! Key binding for mouse moved event
     125    KeyBinding bindingMouseMoved_;
     126    //! Key binding for mouse scrolled event
     127    KeyBinding bindingMouseScrolled_;
    159128    //! Names of the mouse buttons as strings
    160129    std::string mouseButtonNames_[numberOfMouseButtons_s];
     
    163132    static const int numberOfJoyStickButtons_s = 32;
    164133    //! Array of input events for every pressed joy stick button
    165     std::string bindingsJoyStickButtonPress_  [numberOfJoyStickButtons_s];
     134    KeyBinding bindingsJoyStickButtonPress_  [numberOfJoyStickButtons_s];
    166135    //! Array of input events for every released joy stick button
    167     std::string bindingsJoyStickButtonRelease_[numberOfJoyStickButtons_s];
     136    KeyBinding bindingsJoyStickButtonRelease_[numberOfJoyStickButtons_s];
    168137    //! Array of input events for every held joy stick button
    169     std::string bindingsJoyStickButtonHold_   [numberOfJoyStickButtons_s];
     138    KeyBinding bindingsJoyStickButtonHold_   [numberOfJoyStickButtons_s];
    170139    //! Names of the joy stick buttons as strings
    171140    std::string joyStickButtonNames_[numberOfJoyStickButtons_s];
     
    186155  //private:
    187156  //  // input events
    188                 //bool keyPressed   (const OIS::KeyEvent   &arg);
    189                 //bool keyReleased  (const OIS::KeyEvent   &arg);
    190                 //bool keyHeld      (const OIS::KeyEvent   &arg);
     157    //bool keyPressed   (const OIS::KeyEvent   &arg);
     158    //bool keyReleased  (const OIS::KeyEvent   &arg);
     159    //bool keyHeld      (const OIS::KeyEvent   &arg);
    191160
    192   //  bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButtonID id);
    193                 //bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id);
    194                 //bool mouseHeld    (const OIS::MouseEvent &arg, OIS::MouseButtonID id);
     161  //  bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButton id);
     162    //bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButton id);
     163    //bool mouseHeld    (const OIS::MouseEvent &arg, OIS::MouseButton id);
    195164  //  bool mouseMoved   (const OIS::MouseEvent &arg);
    196165
    197                 //bool buttonPressed (const OIS::JoyStickEvent &arg, int button);
    198                 //bool buttonReleased(const OIS::JoyStickEvent &arg, int button);
    199                 //bool buttonHeld    (const OIS::JoyStickEvent &arg, int button);
    200                 //bool axisMoved     (const OIS::JoyStickEvent &arg, int axis);
    201                 //bool sliderMoved   (const OIS::JoyStickEvent &arg, int id);
    202                 //bool povMoved      (const OIS::JoyStickEvent &arg, int id);
     166    //bool buttonPressed (const OIS::JoyStickEvent &arg, int button);
     167    //bool buttonReleased(const OIS::JoyStickEvent &arg, int button);
     168    //bool buttonHeld    (const OIS::JoyStickEvent &arg, int button);
     169    //bool axisMoved     (const OIS::JoyStickEvent &arg, int axis);
     170    //bool sliderMoved   (const OIS::JoyStickEvent &arg, int id);
     171    //bool povMoved      (const OIS::JoyStickEvent &arg, int id);
    203172  //};
    204173
Note: See TracChangeset for help on using the changeset viewer.