[Orxonox-commit 1189] r5910 - in code/branches/core5/src: external/ois external/ois/win32 libraries/core/input orxonox/gamestates
rgrieder at orxonox.net
rgrieder at orxonox.net
Thu Oct 8 21:47:28 CEST 2009
Author: rgrieder
Date: 2009-10-08 21:47:28 +0200 (Thu, 08 Oct 2009)
New Revision: 5910
Modified:
code/branches/core5/src/external/ois/changes_orxonox.diff
code/branches/core5/src/external/ois/win32/Win32ForceFeedback.cpp
code/branches/core5/src/libraries/core/input/InputManager.cc
code/branches/core5/src/libraries/core/input/InputManager.h
code/branches/core5/src/libraries/core/input/InputState.cc
code/branches/core5/src/libraries/core/input/InputState.h
code/branches/core5/src/orxonox/gamestates/GSLevel.cc
code/branches/core5/src/orxonox/gamestates/GSMainMenu.cc
Log:
- Fixed force feedback output pollution problem in OIS.
- Fixed InputManager too many times reloading problem.
Modified: code/branches/core5/src/external/ois/changes_orxonox.diff
===================================================================
--- code/branches/core5/src/external/ois/changes_orxonox.diff 2009-10-08 19:13:24 UTC (rev 5909)
+++ code/branches/core5/src/external/ois/changes_orxonox.diff 2009-10-08 19:47:28 UTC (rev 5910)
@@ -22,3 +22,14 @@
using namespace OIS;
+--- win32/Win32ForceFeedback.cpp
++++ win32/Win32ForceFeedback.cpp
+@@ -25,7 +25,7 @@
+ #include <Math.h>
+
+ // 0 = No trace; 1 = Important traces; 2 = Debug traces
+-#define OIS_WIN32_JOYFF_DEBUG 1
++#define OIS_WIN32_JOYFF_DEBUG 0
+
+ #if (defined (_DEBUG) || defined(OIS_WIN32_JOYFF_DEBUG))
+ #include <iostream>
Modified: code/branches/core5/src/external/ois/win32/Win32ForceFeedback.cpp
===================================================================
--- code/branches/core5/src/external/ois/win32/Win32ForceFeedback.cpp 2009-10-08 19:13:24 UTC (rev 5909)
+++ code/branches/core5/src/external/ois/win32/Win32ForceFeedback.cpp 2009-10-08 19:47:28 UTC (rev 5910)
@@ -25,7 +25,7 @@
#include <Math.h>
// 0 = No trace; 1 = Important traces; 2 = Debug traces
-#define OIS_WIN32_JOYFF_DEBUG 1
+#define OIS_WIN32_JOYFF_DEBUG 0
#if (defined (_DEBUG) || defined(OIS_WIN32_JOYFF_DEBUG))
#include <iostream>
Modified: code/branches/core5/src/libraries/core/input/InputManager.cc
===================================================================
--- code/branches/core5/src/libraries/core/input/InputManager.cc 2009-10-08 19:13:24 UTC (rev 5909)
+++ code/branches/core5/src/libraries/core/input/InputManager.cc 2009-10-08 19:47:28 UTC (rev 5910)
@@ -86,7 +86,7 @@
: internalState_(Bad)
, oisInputManager_(0)
, devices_(2)
- , bExclusiveMouse_(false)
+ , mouseMode_(MouseMode::Nonexclusive)
, emptyState_(0)
, calibratorCallbackHandler_(0)
{
@@ -96,6 +96,8 @@
this->setConfigValues();
+ if (GraphicsManager::getInstance().isFullScreen())
+ mouseMode_ = MouseMode::Exclusive;
this->loadDevices();
// Lowest priority empty InputState
@@ -152,7 +154,7 @@
paramList.insert(std::make_pair("w32_keyboard", "DISCL_NONEXCLUSIVE"));
paramList.insert(std::make_pair("w32_keyboard", "DISCL_FOREGROUND"));
paramList.insert(std::make_pair("w32_mouse", "DISCL_FOREGROUND"));
- if (bExclusiveMouse_ || GraphicsManager::getInstance().isFullScreen())
+ if (mouseMode_ == MouseMode::Exclusive || GraphicsManager::getInstance().isFullScreen())
{
// Disable Windows key plus special keys (like play, stop, next, etc.)
paramList.insert(std::make_pair("w32_keyboard", "DISCL_NOWINKEY"));
@@ -501,11 +503,15 @@
activeStatesTicked_.push_back(*it);
// Check whether we have to change the mouse mode
+ MouseMode::Value requestedMode = MouseMode::Dontcare;
std::vector<InputState*>& mouseStates = devices_[InputDeviceEnumerator::Mouse]->getStateListRef();
- if (mouseStates.empty() && bExclusiveMouse_ ||
- !mouseStates.empty() && mouseStates.front()->getIsExclusiveMouse() != bExclusiveMouse_)
+ if (mouseStates.empty())
+ requestedMode = MouseMode::Nonexclusive;
+ else
+ requestedMode = mouseStates.front()->getMouseMode();
+ if (requestedMode != MouseMode::Dontcare && mouseMode_ != requestedMode)
{
- bExclusiveMouse_ = !bExclusiveMouse_;
+ mouseMode_ = requestedMode;
if (!GraphicsManager::getInstance().isFullScreen())
this->reloadInternal();
}
Modified: code/branches/core5/src/libraries/core/input/InputManager.h
===================================================================
--- code/branches/core5/src/libraries/core/input/InputManager.h 2009-10-08 19:13:24 UTC (rev 5909)
+++ code/branches/core5/src/libraries/core/input/InputManager.h 2009-10-08 19:47:28 UTC (rev 5910)
@@ -190,7 +190,7 @@
State internalState_; //!< Current internal state
OIS::InputManager* oisInputManager_; //!< OIS input manager
std::vector<InputDevice*> devices_; //!< List of all input devices (keyboard, mouse, joy sticks)
- bool bExclusiveMouse_; //!< Currently applied mouse mode
+ MouseMode::Value mouseMode_; //!< Currently applied mouse mode
// some internally handled states and handlers
InputState* emptyState_; //!< Lowest priority states (makes handling easier)
Modified: code/branches/core5/src/libraries/core/input/InputState.cc
===================================================================
--- code/branches/core5/src/libraries/core/input/InputState.cc 2009-10-08 19:13:24 UTC (rev 5909)
+++ code/branches/core5/src/libraries/core/input/InputState.cc 2009-10-08 19:47:28 UTC (rev 5910)
@@ -36,7 +36,7 @@
: name_(name)
, bAlwaysGetsInput_(bAlwaysGetsInput)
, bTransparent_(bTransparent)
- , bExclusiveMouse_(true)
+ , mouseMode_(MouseMode::Dontcare)
, bExpired_(true)
, handlers_(2)
, joyStickHandlerAll_(0)
Modified: code/branches/core5/src/libraries/core/input/InputState.h
===================================================================
--- code/branches/core5/src/libraries/core/input/InputState.h 2009-10-08 19:13:24 UTC (rev 5909)
+++ code/branches/core5/src/libraries/core/input/InputState.h 2009-10-08 19:47:28 UTC (rev 5910)
@@ -55,6 +55,16 @@
static const int Detector = HighPriority + 2;
};
+ namespace MouseMode
+ {
+ enum Value
+ {
+ Exclusive,
+ Nonexclusive,
+ Dontcare
+ };
+ }
+
/**
@brief
InputStates allow you to customise the input event targets at runtime.
@@ -119,8 +129,8 @@
//! Sets an InputHandler to be used for all devices
void setHandler (InputHandler* handler);
- void setIsExclusiveMouse(bool value) { bExclusiveMouse_ = value; this->bExpired_ = true; }
- bool getIsExclusiveMouse() const { return bExclusiveMouse_; }
+ void setMouseMode(MouseMode::Value value) { mouseMode_ = value; this->bExpired_ = true; }
+ MouseMode::Value getMouseMode() const { return mouseMode_; }
//! Returns the name of the state (which is unique!)
const std::string& getName() const { return name_; }
@@ -173,7 +183,7 @@
const std::string name_; //!< Name of the state
const bool bAlwaysGetsInput_; //!< See class declaration for explanation
const bool bTransparent_; //!< See class declaration for explanation
- bool bExclusiveMouse_; //!< See class declaration for explanation
+ MouseMode::Value mouseMode_; //!< See class declaration for explanation
int priority_; //!< Current priority (might change)
bool bExpired_; //!< See hasExpired()
std::vector<InputHandler*> handlers_; //!< Vector with all handlers where the index is the device ID
Modified: code/branches/core5/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/branches/core5/src/orxonox/gamestates/GSLevel.cc 2009-10-08 19:13:24 UTC (rev 5909)
+++ code/branches/core5/src/orxonox/gamestates/GSLevel.cc 2009-10-08 19:47:28 UTC (rev 5910)
@@ -67,10 +67,12 @@
if (GameMode::showsGraphics())
{
gameInputState_ = InputManager::getInstance().createInputState("game");
+ gameInputState_->setMouseMode(MouseMode::Exclusive);
gameInputState_->setHandler(KeyBinderManager::getInstance().getDefaultAsHandler());
KeyBinderManager::getInstance().setToDefault();
guiMouseOnlyInputState_ = InputManager::getInstance().createInputState("guiMouseOnly");
+ guiMouseOnlyInputState_->setMouseMode(MouseMode::Exclusive);
guiMouseOnlyInputState_->setMouseHandler(GUIManager::getInstancePtr());
guiKeysOnlyInputState_ = InputManager::getInstance().createInputState("guiKeysOnly");
Modified: code/branches/core5/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- code/branches/core5/src/orxonox/gamestates/GSMainMenu.cc 2009-10-08 19:13:24 UTC (rev 5909)
+++ code/branches/core5/src/orxonox/gamestates/GSMainMenu.cc 2009-10-08 19:47:28 UTC (rev 5910)
@@ -49,10 +49,10 @@
, inputState_(0)
{
inputState_ = InputManager::getInstance().createInputState("mainMenu");
+ inputState_->setMouseMode(MouseMode::Nonexclusive);
inputState_->setHandler(GUIManager::getInstancePtr());
inputState_->setKeyHandler(KeyBinderManager::getInstance().getDefaultAsHandler());
inputState_->setJoyStickHandler(&InputHandler::EMPTY);
- inputState_->setIsExclusiveMouse(false);
// create an empty Scene
this->scene_ = new Scene(NULL);
More information about the Orxonox-commit
mailing list