Changeset 1878 for code/trunk/src/core/input/InputManager.h
- Timestamp:
- Oct 3, 2008, 1:26:48 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/core/input/InputManager.h
r1788 r1878 108 108 void reloadInputSystem(bool joyStickSupport = true); 109 109 110 void clearBuffers(); 111 110 112 int numberOfKeyboards() { return keyboard_ ? 1 : 0; } 111 113 int numberOfMice() { return mouse_ ? 1 : 0; } … … 115 117 116 118 template <class T> 117 T* createInputState(const std::string& name, int priority) 118 { 119 T* state = new T; 120 if (_configureInputState(state, name, priority)) 121 return state; 122 else 123 { 124 delete state; 125 return 0; 126 } 127 } 119 T* createInputState(const std::string& name, int priority); 128 120 129 121 InputState* getState (const std::string& name); … … 139 131 static InputManager* getInstancePtr() { return singletonRef_s; } 140 132 141 public:// console commands133 // console commands 142 134 static void storeKeyStroke(const std::string& name); 143 135 static void keyBind(const std::string& command); 144 136 static void calibrate(); 145 137 static void reload(bool joyStickSupport = true); 138 139 public: // variables 140 static EmptyHandler EMPTY_HANDLER; 146 141 147 142 private: // functions … … 197 192 InputManagerState internalState_; //!< Current internal state 198 193 199 // some internally handled states 194 // some internally handled states and handlers 200 195 SimpleInputState* stateDetector_; //!< KeyDetector instance 201 196 SimpleInputState* stateCalibrator_; … … 234 229 static InputManager* singletonRef_s; 235 230 }; 231 232 /** 233 @brief 234 Creates a new InputState by type, name and priority. 235 236 You will have to use this method because the 237 c'tors and d'tors are private. 238 @remarks 239 The InputManager will take care of the state completely. That also 240 means it gets deleted when the InputManager is destroyed! 241 @param name 242 Name of the InputState when referenced as string 243 @param priority 244 Priority matters when multiple states are active. You can specify any 245 number, but 1 - 99 is preferred (99 means high). 246 */ 247 template <class T> 248 T* InputManager::createInputState(const std::string& name, int priority) 249 { 250 T* state = new T; 251 if (_configureInputState(state, name, priority)) 252 return state; 253 else 254 { 255 delete state; 256 return 0; 257 } 258 } 236 259 } 237 260
Note: See TracChangeset
for help on using the changeset viewer.