Changeset 6537 for code/branches/gamestate/src/libraries/core/input
- Timestamp:
- Mar 16, 2010, 1:49:16 PM (15 years ago)
- Location:
- code/branches/gamestate/src/libraries/core/input
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gamestate/src/libraries/core/input/InputManager.cc
r6422 r6537 87 87 , oisInputManager_(0) 88 88 , devices_(2) 89 , mouseMode_(MouseMode::Nonexclusive)89 , exclusiveMouse_(TriBool::False) 90 90 , emptyState_(0) 91 91 , calibratorCallbackHandler_(0) … … 98 98 99 99 if (GraphicsManager::getInstance().isFullScreen()) 100 mouseMode_ = MouseMode::Exclusive;100 exclusiveMouse_ = TriBool::True; 101 101 this->loadDevices(); 102 102 … … 155 155 paramList.insert(std::make_pair("w32_keyboard", "DISCL_FOREGROUND")); 156 156 paramList.insert(std::make_pair("w32_mouse", "DISCL_FOREGROUND")); 157 if ( mouseMode_ == MouseMode::Exclusive || GraphicsManager::getInstance().isFullScreen())157 if (exclusiveMouse_ == TriBool::True || GraphicsManager::getInstance().isFullScreen()) 158 158 { 159 159 // Disable Windows key plus special keys (like play, stop, next, etc.) … … 168 168 paramList.insert(std::make_pair("XAutoRepeatOn", "true")); 169 169 170 if ( mouseMode_ == MouseMode::Exclusive || GraphicsManager::getInstance().isFullScreen())170 if (exclusiveMouse_ == TriBool::True || GraphicsManager::getInstance().isFullScreen()) 171 171 { 172 172 if (CommandLineParser::getValue("keyboard_no_grab").getBool()) … … 504 504 505 505 // Check whether we have to change the mouse mode 506 MouseMode::Value requestedMode = MouseMode::Dontcare;506 TriBool::Value requestedMode = TriBool::Dontcare; 507 507 std::vector<InputState*>& mouseStates = devices_[InputDeviceEnumerator::Mouse]->getStateListRef(); 508 508 if (mouseStates.empty()) 509 requestedMode = MouseMode::Nonexclusive;509 requestedMode = TriBool::False; 510 510 else 511 requestedMode = mouseStates.front()->getMouse Mode();512 if (requestedMode != MouseMode::Dontcare && mouseMode_ != requestedMode)513 { 514 mouseMode_ = requestedMode;511 requestedMode = mouseStates.front()->getMouseExclusive(); 512 if (requestedMode != TriBool::Dontcare && exclusiveMouse_ != requestedMode) 513 { 514 exclusiveMouse_ = requestedMode; 515 515 if (!GraphicsManager::getInstance().isFullScreen()) 516 516 this->reloadInternal(); -
code/branches/gamestate/src/libraries/core/input/InputManager.h
r6417 r6537 38 38 39 39 #include "util/Singleton.h" 40 #include "util/TriBool.h" 40 41 #include "core/WindowEventListener.h" 41 42 #include "InputState.h" … … 159 160 - The removal process is being postponed if InputManager::preUpdate() is currently running. 160 161 */ 161 bool destroyState(const std::string& name); 162 bool destroyState(const std::string& name); // tolua_export 162 163 163 164 //------------------------------- … … 196 197 OIS::InputManager* oisInputManager_; //!< OIS input manager 197 198 std::vector<InputDevice*> devices_; //!< List of all input devices (keyboard, mouse, joy sticks) 198 MouseMode::Value mouseMode_;//!< Currently applied mouse mode199 TriBool::Value exclusiveMouse_; //!< Currently applied mouse mode 199 200 200 201 // some internally handled states and handlers -
code/branches/gamestate/src/libraries/core/input/InputState.cc
r6417 r6537 37 37 , bAlwaysGetsInput_(bAlwaysGetsInput) 38 38 , bTransparent_(bTransparent) 39 , mouseMode_(MouseMode::Dontcare)39 , exclusiveMouse_(TriBool::Dontcare) 40 40 , bExpired_(true) 41 41 , handlers_(2) -
code/branches/gamestate/src/libraries/core/input/InputState.h
r5929 r6537 37 37 38 38 #include "util/OrxEnum.h" 39 #include "util/TriBool.h" 39 40 #include "InputHandler.h" 40 41 #include "JoyStickQuantityListener.h" … … 56 57 }; 57 58 58 namespace MouseMode59 {60 enum Value61 {62 Exclusive,63 Nonexclusive,64 Dontcare65 };66 }67 59 68 60 /** … … 73 65 that stack and only the top one gets the input events. This is done for 74 66 every device (keyboard, mouse, all joy sticks) separately to allow 75 for in tance keyboard input capturing for the console while you can still67 for instance keyboard input capturing for the console while you can still 76 68 steer a ship with the mouse. 77 69 There are two exceptions to this behaviour though: … … 83 75 the state will always receive input as long as it is activated. 84 76 - Note: If you mark an InputState with both parameters on, then it will 85 not influence on y other InputState at all.77 not influence only other InputState at all. 86 78 87 79 @par Priorities … … 95 87 @par Exclusive/Non-Exclusive mouse Mode 96 88 You can select a specific mouse mode that tells whether the application 97 should have exclusive access to it or not.89 should have exclusive access to it or not. 98 90 When in non-exclusive mode, you can move the mouse out of the window 99 91 like with any other normal window (only for windowed mode!). … … 130 122 void setHandler (InputHandler* handler); 131 123 132 void setMouse Mode(MouseMode::Value value) { mouseMode_ = value; this->bExpired_ = true; }133 MouseMode::Value getMouseMode() const { return mouseMode_; }124 void setMouseExclusive(TriBool::Value value) { exclusiveMouse_ = value; this->bExpired_ = true; } 125 TriBool::Value getMouseExclusive() const { return exclusiveMouse_; } 134 126 135 127 //! Returns the name of the state (which is unique!) … … 184 176 const bool bAlwaysGetsInput_; //!< See class declaration for explanation 185 177 const bool bTransparent_; //!< See class declaration for explanation 186 MouseMode::Value mouseMode_;//!< See class declaration for explanation178 TriBool::Value exclusiveMouse_; //!< See class declaration for explanation 187 179 int priority_; //!< Current priority (might change) 188 180 bool bExpired_; //!< See hasExpired()
Note: See TracChangeset
for help on using the changeset viewer.