Changeset 1659 for code/branches/gui/src/core/input
- Timestamp:
- Aug 14, 2008, 9:41:48 PM (16 years ago)
- Location:
- code/branches/gui/src/core/input
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/core/input/InputManager.cc
r1656 r1659 59 59 namespace orxonox 60 60 { 61 SetConsoleCommandShortcut(InputManager, keyBind); 62 SetConsoleCommandShortcut(InputManager, storeKeyStroke); 63 SetConsoleCommandShortcut(InputManager, calibrate); 61 SetConsoleCommand(InputManager, keyBind, true); 62 SetConsoleCommand(InputManager, storeKeyStroke, true); 63 SetConsoleCommand(InputManager, calibrate, true); 64 SetConsoleCommand(InputManager, reload, false); 64 65 65 66 std::string InputManager::bindingCommmandString_s = ""; … … 132 133 void InputManager::initialise(size_t windowHnd, int windowWidth, int windowHeight, bool joyStickSupport) 133 134 { 134 if (internalState_ == Uninitialised) 135 { 136 CCOUT(3) << "Initialising Input System..." << std::endl; 135 CCOUT(3) << "Initialising Input System..." << std::endl; 136 137 if (!(internalState_ & OISReady)) 138 { 137 139 CCOUT(4) << "Initialising OIS components..." << std::endl; 138 140 … … 169 171 _clearBuffers(); 170 172 173 // load joy stick calibration 174 setConfigValues(); 175 176 internalState_ |= OISReady; 177 171 178 CCOUT(ORX_DEBUG) << "Initialising OIS components done." << std::endl; 172 173 setConfigValues(); 179 } 180 else 181 { 182 CCOUT(2) << "Warning: OIS compoments already initialised, skipping" << std::endl; 183 } 184 185 if (!(internalState_ & InternalsReady)) 186 { 187 CCOUT(4) << "Initialising InputStates components..." << std::endl; 174 188 175 189 stateEmpty_ = createInputState<SimpleInputState>("empty", -1); … … 188 202 stateCalibrator_->setKeyHandler(buffer); 189 203 190 _updateActiveStates(); 191 192 internalState_ = Ready; 193 194 CCOUT(3) << "Initialising complete." << std::endl; 195 } 196 else 197 { 198 CCOUT(2) << "Warning: OIS compoments already initialised, skipping" << std::endl; 199 } 204 internalState_ |= InternalsReady; 205 206 CCOUT(4) << "Initialising InputStates complete." << std::endl; 207 } 208 209 _updateActiveStates(); 210 211 CCOUT(3) << "Initialising complete." << std::endl; 200 212 } 201 213 … … 486 498 487 499 joySticks_.clear(); 500 _redimensionLists(); 488 501 } 489 502 CCOUT(4) << "Joy sticks destroyed." << std::endl; … … 543 556 internalState_ |= ReloadRequest; 544 557 // Misuse of internalState_: We can easily store the joyStickSupport bool. 545 // use Uninitialised as 0 value in order to usethe overloaded |= operator558 // use Uninitialised as 0 value in order to make use of the overloaded |= operator 546 559 internalState_ |= joyStickSupport ? JoyStickSupport : Uninitialised; 547 560 } 548 else if (internalState_ ==Ready)561 else if (internalState_ & OISReady) 549 562 { 550 563 _reload(joyStickSupport); … … 571 584 int mouseHeight = mouse_->getMouseState().height; 572 585 573 internalState_ = Uninitialised; 586 internalState_ &= ~OISReady; 587 574 588 // destroy the devices 575 589 _destroyKeyboard(); … … 674 688 } 675 689 676 internalState_ &= ~ Ready;690 internalState_ &= ~Ticking; 677 691 } 678 692 … … 1257 1271 getInstance().requestEnterState("calibrator"); 1258 1272 } 1273 1274 /** 1275 @brief 1276 Reloads the input system 1277 */ 1278 void InputManager::reload(bool joyStickSupport) 1279 { 1280 getInstance().reloadInputSystem(joyStickSupport); 1281 } 1259 1282 } -
code/branches/gui/src/core/input/InputManager.h
r1656 r1659 92 92 enum InputManagerState 93 93 { 94 Uninitialised = 0, 95 Ready = 1, 96 Ticking = 2, 97 Calibrating = 4, 98 ReloadRequest = 8, 99 JoyStickSupport = 16 // used with ReloadRequest to store a bool 94 Uninitialised = 0x00, 95 OISReady = 0x01, 96 InternalsReady = 0x02, 97 Ticking = 0x04, 98 Calibrating = 0x08, 99 ReloadRequest = 0x10, 100 JoyStickSupport = 0x20 // used with ReloadRequest to store a bool 100 101 }; 101 102 … … 139 140 static void keyBind(const std::string& command); 140 141 static void calibrate(); 142 static void reload(bool joyStickSupport = true); 141 143 142 144 private: // functions -
code/branches/gui/src/core/input/SimpleInputState.cc
r1653 r1659 55 55 joyStickHandler_.resize(n); 56 56 57 if ( oldSize > n)57 if (n > oldSize) 58 58 { 59 59 // we have to add the handler in joyStickHandlerAll_ to the joyStickHandler_[>n]
Note: See TracChangeset
for help on using the changeset viewer.