Changeset 1755 for code/trunk/src/core/input/KeyBinder.h
- Timestamp:
- Sep 10, 2008, 1:37:36 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/gui (added) merged: 1636,1638,1640-1647,1649-1654,1656,1659-1665,1670,1672-1674,1686,1688-1692,1694-1697,1704 /code/branches/input (added) merged: 1629-1630
- Property svn:mergeinfo changed
-
code/trunk/src/core/input/KeyBinder.h
r1535 r1755 28 28 29 29 /** 30 @file 31 @brief Different definitions of input processing. 32 */ 30 @file 31 @brief 32 Different definitions of input processing. 33 */ 33 34 34 35 #ifndef _KeyBinder_H__ … … 46 47 namespace orxonox 47 48 { 48 /** 49 @brief Handles mouse, keyboard and joy stick input while in the actual game mode. 50 Manages the key bindings. 51 */ 52 class _CoreExport KeyBinder : public KeyHandler, public MouseHandler, public JoyStickHandler, public OrxonoxClass 53 { 54 public: 55 KeyBinder (); 56 virtual ~KeyBinder(); 49 /** 50 @brief 51 Handles mouse, keyboard and joy stick input while in the actual game mode. 52 Manages the key bindings. 53 */ 54 class _CoreExport KeyBinder : public KeyHandler, public MouseHandler, public JoyStickHandler, public OrxonoxClass 55 { 56 public: 57 KeyBinder (); 58 virtual ~KeyBinder(); 57 59 58 void loadBindings();59 void clearBindings();60 void setConfigValues();61 void resetJoyStickAxes();60 void loadBindings(); 61 void clearBindings(); 62 void setConfigValues(); 63 void resetJoyStickAxes(); 62 64 63 protected: // functions 64 void tickInput(float dt, const HandlerState& state); 65 protected: // functions 66 void tickInput(float dt); 67 //void tickInput(float dt, int device); 68 void tickKey(float dt) { } 69 void tickMouse(float dt); 70 void tickJoyStick(float dt, unsigned int joyStick); 71 void tickDevices(unsigned int begin, unsigned int end); 65 72 66 virtual void readTrigger(Button& button);73 virtual void readTrigger(Button& button); 67 74 68 void keyPressed (const KeyEvent& evt);69 void keyReleased(const KeyEvent& evt);70 void keyHeld (const KeyEvent& evt);75 void keyPressed (const KeyEvent& evt); 76 void keyReleased(const KeyEvent& evt); 77 void keyHeld (const KeyEvent& evt); 71 78 72 void mouseButtonPressed (MouseButton::Enum id);73 void mouseButtonReleased(MouseButton::Enum id);74 void mouseButtonHeld (MouseButton::Enum id);75 void mouseMoved (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);76 void mouseScrolled (int abs, int rel);79 void mouseButtonPressed (MouseButton::Enum id); 80 void mouseButtonReleased(MouseButton::Enum id); 81 void mouseButtonHeld (MouseButton::Enum id); 82 void mouseMoved (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize); 83 void mouseScrolled (int abs, int rel); 77 84 78 void joyStickButtonPressed (int joyStickID, int button);79 void joyStickButtonReleased(int joyStickID, int button);80 void joyStickButtonHeld (int joyStickID, int button);81 void joyStickAxisMoved (int joyStickID,int axis, float value);85 void joyStickButtonPressed (unsigned int joyStickID, JoyStickButton::Enum id); 86 void joyStickButtonReleased(unsigned int joyStickID, JoyStickButton::Enum id); 87 void joyStickButtonHeld (unsigned int joyStickID, JoyStickButton::Enum id); 88 void joyStickAxisMoved (unsigned int joyStickID, unsigned int axis, float value); 82 89 83 protected: // variables84 //! denotes the number of different keys there are in OIS.85 static const unsigned int nKeys_s = 0xEE;86 //! Actual key bindings as bundle for Press, Hold and Release87 Button keys_ [nKeys_s];90 protected: // variables 91 //! denotes the number of different keys there are in OIS. 92 static const unsigned int nKeys_s = 0xEE; 93 //! Actual key bindings as bundle for Press, Hold and Release 94 Button keys_ [nKeys_s]; 88 95 89 //! denotes the number of different mouse buttons there are in OIS.90 static const unsigned int nMouseButtons_s = 8 + 2*2; // 8 buttons and 2 scroll wheels91 //! Actual key bindings as bundle for Press, Hold and Release92 Button mouseButtons_ [nMouseButtons_s];96 //! denotes the number of different mouse buttons there are in OIS. 97 static const unsigned int nMouseButtons_s = 8 + 2*2; // 8 buttons and 2 scroll wheels 98 //! Actual key bindings as bundle for Press, Hold and Release 99 Button mouseButtons_ [nMouseButtons_s]; 93 100 94 //! denotes the number of different joy stick buttons there are in OIS.95 static const unsigned int nJoyStickButtons_s = 32 + 4 * 4; // 32 buttons and 4 POVs with 4 buttons96 //! Actual key bindings as bundle for Press, Hold and Release97 Button joyStickButtons_ [nJoyStickButtons_s];101 //! denotes the number of different joy stick buttons there are in OIS. 102 static const unsigned int nJoyStickButtons_s = 32 + 4 * 4; // 32 buttons and 4 POVs with 4 buttons 103 //! Actual key bindings as bundle for Press, Hold and Release 104 Button joyStickButtons_ [nJoyStickButtons_s]; 98 105 99 //! denotes the number of half axes (every axis twice) there can be.100 static const unsigned int nHalfAxes_s = 56;101 /**102 * Array with all the half axes for mouse and joy sticks.103 * Keep in mind that the positions are fixed and that the first entry is the104 * positive one and the second is negative.105 * Sequence is as follows:106 * 0 - 3: Mouse x and y107 * 4 - 7: empty108 * 8 - 23: joy stick slider axes 1 to 8109 * 24 - 55: joy stick axes 1 - 16110 */111 HalfAxis halfAxes_[nHalfAxes_s];106 //! denotes the number of half axes (every axis twice) there can be. 107 static const unsigned int nHalfAxes_s = 56; 108 /** 109 * Array with all the half axes for mouse and joy sticks. 110 * Keep in mind that the positions are fixed and that the first entry is the 111 * positive one and the second is negative. 112 * Sequence is as follows: 113 * 0 - 3: Mouse x and y 114 * 4 - 7: empty 115 * 8 - 23: joy stick slider axes 1 to 8 116 * 24 - 55: joy stick axes 1 - 16 117 */ 118 HalfAxis halfAxes_[nHalfAxes_s]; 112 119 113 /** 114 * Commands that have additional parameters (axes) are executed at the end of 115 * the tick() so that all values can be buffered for single execution. 116 */ 117 std::vector<BufferedParamCommand*> paramCommandBuffer_; 120 /** 121 @brief 122 Commands that have additional parameters (axes) are executed at the end of 123 the tick() so that all values can be buffered for single execution. 124 */ 125 std::vector<BufferedParamCommand*> paramCommandBuffer_; 118 126 119 //! Keeps track of the absolute mouse value (incl. scroll wheel)120 int mousePosition_[2];121 //! Used to derive mouse input if requested122 int mouseRelative_[2];123 float deriveTime_;127 //! Keeps track of the absolute mouse value (incl. scroll wheel) 128 int mousePosition_[2]; 129 //! Used to derive mouse input if requested 130 int mouseRelative_[2]; 131 float deriveTime_; 124 132 125 //##### ConfigValues ##### 126 //! Threshold for analog triggers until which the state is 0. 127 float analogThreshold_; 128 //! Threshold for analog triggers until which the button is not pressed. 129 float buttonThreshold_; 130 //! Derive mouse input for absolute values? 131 bool bDeriveMouseInput_; 132 //! Accuracy of the mouse input deriver. The higher the more precise, but laggier. 133 float derivePeriod_; 134 //! mouse sensitivity 135 float mouseSensitivity_; 136 //! mouse sensitivity if mouse input is derived 137 float mouseSensitivityDerived_; 138 //! Whether or not to clip abslute mouse values to 1024 139 bool bClipMouse_; 140 }; 133 134 //##### ConfigValues ##### 135 136 //! Threshold for analog triggers until which the state is 0. 137 float analogThreshold_; 138 //! Threshold for analog triggers until which the button is not pressed. 139 float buttonThreshold_; 140 //! Derive mouse input for absolute values? 141 bool bDeriveMouseInput_; 142 //! Accuracy of the mouse input deriver. The higher the more precise, but laggier. 143 float derivePeriod_; 144 //! mouse sensitivity 145 float mouseSensitivity_; 146 //! mouse sensitivity if mouse input is derived 147 float mouseSensitivityDerived_; 148 //! Whether or not to clip abslute mouse values to 1024 149 bool bClipMouse_; 150 }; 141 151 } 142 152
Note: See TracChangeset
for help on using the changeset viewer.