Changeset 1502 for code/trunk/src/core/InputManager.h
- Timestamp:
- Jun 1, 2008, 3:54:20 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/core/InputManager.h
r1349 r1502 65 65 public: 66 66 IntVector2 sliderStates[4]; 67 }; 68 69 /** 70 * Struct for storing a custom input state 71 */ 72 struct StoredState 73 { 74 std::vector<KeyHandler*> activeKeyHandlers_; 75 std::vector<MouseHandler*> activeMouseHandlers_; 76 std::vector<std::vector<JoyStickHandler*> > activeJoyStickHandlers_; 77 std::vector<std::pair<InputTickable*, HandlerState> > activeHandlers_; 78 }; 79 80 struct JoyStickCalibration 81 { 82 int zeroStates[24]; 83 float positiveCoeff[24]; 84 float negativeCoeff[24]; 67 85 }; 68 86 … … 80 98 enum InputState 81 99 { 82 IS_UNINIT, //!< InputManager has not yet been initialised. 83 IS_NONE, //!< Input is discarded. 84 IS_NORMAL, //!< Normal play state. Key and button bindings are active. 85 IS_GUI, //!< All OIS input events are passed to CEGUI. 86 IS_CONSOLE, //!< Keyboard input is redirected to the InputBuffer. 87 IS_CUSTOM //!< Any possible configuration. 100 IS_UNINIT, //!< InputManager has not yet been initialised. 101 IS_NONE, //!< Input is discarded. 102 IS_NORMAL, //!< Normal play state. Key and button bindings are active. 103 IS_GUI, //!< All OIS input events are passed to CEGUI. 104 IS_CONSOLE, //!< Keyboard input is redirected to the InputBuffer. 105 IS_DETECT, //!< All the input additionally goes to the KeyDetector 106 IS_NODETECT, //!< remove KeyDetector 107 IS_NOCALIBRATE, 108 IS_CALIBRATE, 109 IS_CUSTOM //!< Any possible configuration. 88 110 }; 111 112 public: // member functions 113 void setConfigValues(); 89 114 90 115 public: // static functions … … 103 128 static void destroyJoySticks(); 104 129 105 static bool isModifierDown(KeyboardModifier::Enum modifier);106 static bool isKeyDown(KeyCode::Enum key);130 //static bool isModifierDown(KeyboardModifier::Enum modifier); 131 //static bool isKeyDown(KeyCode::Enum key); 107 132 //static const MouseState getMouseState(); 108 133 //static const JoyStickState getJoyStickState(unsigned int ID); … … 112 137 static void setInputState(const InputState state); 113 138 static InputState getInputState(); 139 140 static void storeKeyStroke(const std::string& name); 141 static void keyBind(const std::string& command); 142 143 static void calibrate(); 114 144 115 145 static bool addKeyHandler (KeyHandler* handler, const std::string& name); … … 152 182 153 183 void _updateTickables(); 184 185 void _saveState(); 186 void _restoreState(); 187 188 void _completeCalibration(); 189 190 void _fireAxis(unsigned int iJoyStick, int axis, int value); 191 unsigned int _getJoystick(const OIS::JoyStickEvent& arg); 154 192 155 193 void tick(float dt); … … 172 210 173 211 private: // variables 174 OIS::InputManager* inputSystem_; //!< OIS input manager175 OIS::Keyboard* keyboard_; //!< OIS mouse176 OIS::Mouse* mouse_; //!< OIS keyboard177 std::vector<OIS::JoyStick*> joySticks_; //!< OIS joy sticks212 OIS::InputManager* inputSystem_; //!< OIS input manager 213 OIS::Keyboard* keyboard_; //!< OIS mouse 214 OIS::Mouse* mouse_; //!< OIS keyboard 215 std::vector<OIS::JoyStick*> joySticks_; //!< OIS joy sticks 178 216 unsigned int joySticksSize_; 217 218 KeyBinder* keyBinder_; //!< KeyBinder instance 219 KeyDetector* keyDetector_; //!< KeyDetector instance 220 InputBuffer* buffer_; //!< InputBuffer instance 221 CalibratorCallback* calibratorCallback_; 179 222 180 223 InputState state_; 181 224 InputState stateRequest_; 225 InputState savedState_; 182 226 unsigned int keyboardModifiers_; 227 StoredState savedHandlers_; 228 229 // joystick calibration 230 //std::vector<int> marginalsMaxConfig_; 231 //std::vector<int> marginalsMinConfig_; 232 int marginalsMax_[24]; 233 int marginalsMin_[24]; 234 bool bCalibrated_; 183 235 184 236 //! Keeps track of the joy stick POV states … … 186 238 //! Keeps track of the possibly two slider axes 187 239 std::vector<SliderStates> sliderStates_; 240 std::vector<JoyStickCalibration> joySticksCalibration_; 188 241 189 242 std::map<std::string, KeyHandler*> keyHandlers_; … … 194 247 std::vector<MouseHandler*> activeMouseHandlers_; 195 248 std::vector<std::vector<JoyStickHandler*> > activeJoyStickHandlers_; 196 std::vector< InputTickable*>activeHandlers_;249 std::vector<std::pair<InputTickable*, HandlerState> > activeHandlers_; 197 250 198 251 std::vector<Key> keysDown_; … … 200 253 std::vector<std::vector<int> > joyStickButtonsDown_; 201 254 255 static std::string bindingCommmandString_s; 202 256 }; 203 257
Note: See TracChangeset
for help on using the changeset viewer.