Changeset 2896 for code/trunk/src/core/input/InputManager.h
- Timestamp:
- Apr 6, 2009, 1:59:00 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/gui merged: 2796,2798-2801,2805,2807-2808,2811,2814-2817,2834,2840-2850,2853-2854,2859,2862-2863,2869,2875,2887,2892
- Property svn:mergeinfo changed
-
code/trunk/src/core/input/InputManager.h
r2662 r2896 43 43 #include <stack> 44 44 #include "util/Math.h" 45 #include "util/OrxEnum.h" 45 46 #include "core/OrxonoxClass.h" 46 47 #include "InputInterfaces.h" … … 74 75 float positiveCoeff[24]; 75 76 float negativeCoeff[24]; 77 }; 78 79 struct InputStatePriority : OrxEnum<InputStatePriority> 80 { 81 OrxEnumConstructors(InputStatePriority); 82 83 static const int Empty = -1; 84 static const int Dynamic = 0; 85 86 static const int HighPriority = 1000; 87 static const int Console = HighPriority + 0; 88 static const int Calibrator = HighPriority + 1; 89 static const int Detector = HighPriority + 2; 76 90 }; 77 91 … … 116 130 117 131 template <class T> 118 T* createInputState(const std::string& name, int priority);132 T* createInputState(const std::string& name, bool bAlwaysGetsInput = false, bool bTransparent = false, InputStatePriority priority = InputStatePriority::Dynamic); 119 133 120 134 InputState* getState (const std::string& name); 121 135 InputState* getCurrentState(); 122 ExtendedInputState* getMasterInputState() { return this->stateMaster_; }123 136 bool requestDestroyState (const std::string& name); 124 137 bool requestEnterState (const std::string& name); 125 138 bool requestLeaveState (const std::string& name); 126 139 127 void tick(float dt);140 void update(const Clock& time); 128 141 129 142 static InputManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } … … 165 178 166 179 void _updateActiveStates(); 167 bool _configureInputState(InputState* state, const std::string& name, int priority);180 bool _configureInputState(InputState* state, const std::string& name, bool bAlwaysGetsInput, bool bTransparent, int priority); 168 181 169 182 // input events … … 197 210 // some internally handled states and handlers 198 211 SimpleInputState* stateEmpty_; 199 ExtendedInputState* stateMaster_; //!< Always active master input state200 212 KeyDetector* keyDetector_; //!< KeyDetector instance 201 213 InputBuffer* calibratorCallbackBuffer_; 202 214 203 215 std::map<std::string, InputState*> inputStatesByName_; 204 std::map<int, InputState*> inputStatesByPriority_;205 216 206 217 std::set<InputState*> stateEnterRequests_; //!< Request to enter a new state … … 209 220 210 221 std::map<int, InputState*> activeStates_; 211 std::vector< InputState*> activeStatesTop_; //!< Current input states for joy stick events.212 std::vector<InputState*> activeStatesTicked_; //!< Current input states for joy stick events.222 std::vector<std::vector<InputState*> > activeStatesTriggered_; 223 std::vector<InputState*> activeStatesTicked_; 213 224 214 225 // joystick calibration … … 249 260 */ 250 261 template <class T> 251 T* InputManager::createInputState(const std::string& name, intpriority)262 T* InputManager::createInputState(const std::string& name, bool bAlwaysGetsInput, bool bTransparent, InputStatePriority priority) 252 263 { 253 264 T* state = new T; 254 if (_configureInputState(state, name, priority))265 if (_configureInputState(state, name, bAlwaysGetsInput, bTransparent, priority)) 255 266 return state; 256 267 else
Note: See TracChangeset
for help on using the changeset viewer.