[Orxonox-commit 1820] r6537 - in code/branches/gamestate: data/gui/scripts src/libraries/core src/libraries/core/input src/libraries/util src/orxonox/gamestates
rgrieder at orxonox.net
rgrieder at orxonox.net
Tue Mar 16 13:49:17 CET 2010
Author: rgrieder
Date: 2010-03-16 13:49:16 +0100 (Tue, 16 Mar 2010)
New Revision: 6537
Added:
code/branches/gamestate/src/libraries/util/TriBool.h
Modified:
code/branches/gamestate/data/gui/scripts/BasicGUI.lua
code/branches/gamestate/data/gui/scripts/DecisionPopup.lua
code/branches/gamestate/data/gui/scripts/InGameMenu.lua
code/branches/gamestate/data/gui/scripts/InfoPopup.lua
code/branches/gamestate/data/gui/scripts/InitialiseGUI.lua
code/branches/gamestate/src/libraries/core/Core.cc
code/branches/gamestate/src/libraries/core/GUIManager.cc
code/branches/gamestate/src/libraries/core/GUIManager.h
code/branches/gamestate/src/libraries/core/input/InputManager.cc
code/branches/gamestate/src/libraries/core/input/InputManager.h
code/branches/gamestate/src/libraries/core/input/InputState.cc
code/branches/gamestate/src/libraries/core/input/InputState.h
code/branches/gamestate/src/orxonox/gamestates/GSLevel.cc
code/branches/gamestate/src/orxonox/gamestates/GSMainMenu.cc
Log:
Linked every GUI sheet to exactly one InputState.
Also added util/TriBool that has states {true, false, Dontcare}.
Modified: code/branches/gamestate/data/gui/scripts/BasicGUI.lua
===================================================================
--- code/branches/gamestate/data/gui/scripts/BasicGUI.lua 2010-03-16 10:22:36 UTC (rev 6536)
+++ code/branches/gamestate/data/gui/scripts/BasicGUI.lua 2010-03-16 12:49:16 UTC (rev 6537)
@@ -7,11 +7,11 @@
_G[_REQUIREDNAME] = P
end
--- useless?
+-- useless, even wrong? P is the class, not the object..
P.overlay = nil
-- constructor of the GUI
-function P:new(_filename, _visible, _gui)
+function P:new(_filename, _gui, _visible)
local newElement = {
filename = _filename,
gui = _gui,
@@ -22,10 +22,16 @@
return newElement
end
+-- Override this function if you need to
function P:init()
--- this function is empty and intended for inheriting GUIs to use
end
+-- Override this function if you need to
+-- But don't forget to stick to the naming convention ("GUI_" .. self.filename)
+function P:createInputState()
+ self.inputState = guiMgr:createInputState("GUI_" .. self.filename)
+end
+
-- hide function for the GUI
function P:hide()
self.window:hide()
@@ -40,6 +46,7 @@
function P:load()
self.window = winMgr:loadWindowLayout(self.filename .. ".layout")
+ self:createInputState()
self:init()
return self
end
Modified: code/branches/gamestate/data/gui/scripts/DecisionPopup.lua
===================================================================
--- code/branches/gamestate/data/gui/scripts/DecisionPopup.lua 2010-03-16 10:22:36 UTC (rev 6536)
+++ code/branches/gamestate/data/gui/scripts/DecisionPopup.lua 2010-03-16 12:49:16 UTC (rev 6537)
@@ -8,9 +8,6 @@
_G[_REQUIREDNAME] = P
end
-function P:init()
-end
-
function P.setCallback(functionPtr)
P.functionPtr = functionPtr
end
Modified: code/branches/gamestate/data/gui/scripts/InGameMenu.lua
===================================================================
--- code/branches/gamestate/data/gui/scripts/InGameMenu.lua 2010-03-16 10:22:36 UTC (rev 6536)
+++ code/branches/gamestate/data/gui/scripts/InGameMenu.lua 2010-03-16 12:49:16 UTC (rev 6537)
@@ -8,11 +8,6 @@
_G[_REQUIREDNAME] = P
end
-
-function P:init()
-end
-
-
-- events for ingamemenu
function P.button_quit_clicked(e)
openDecisionPopup( "Do you really want to quit the game?", InGameMenu.callback )
Modified: code/branches/gamestate/data/gui/scripts/InfoPopup.lua
===================================================================
--- code/branches/gamestate/data/gui/scripts/InfoPopup.lua 2010-03-16 10:22:36 UTC (rev 6536)
+++ code/branches/gamestate/data/gui/scripts/InfoPopup.lua 2010-03-16 12:49:16 UTC (rev 6537)
@@ -9,9 +9,6 @@
_G[_REQUIREDNAME] = P
end
-function P:init()
-end
-
function P.execute(functionPtr, arguments)
if functionPtr ~= nil then
if arguments ~= nil then
@@ -22,7 +19,7 @@
end
end
-function P.setText( text )
+function P.setText(text)
winMgr:getWindow("orxonox/InfoPopup_text"):setText( text )
end
@@ -38,7 +35,7 @@
-- events for ingamemenu
function P.close(e)
- hideGUI("InfoPopup")
+ hideGUI(P.filename)
end
return P
Modified: code/branches/gamestate/data/gui/scripts/InitialiseGUI.lua
===================================================================
--- code/branches/gamestate/data/gui/scripts/InitialiseGUI.lua 2010-03-16 10:22:36 UTC (rev 6536)
+++ code/branches/gamestate/data/gui/scripts/InitialiseGUI.lua 2010-03-16 12:49:16 UTC (rev 6537)
@@ -1,8 +1,10 @@
+winMgr = CEGUI.WindowManager:getSingleton()
+guiMgr = orxonox.GUIManager:getInstance()
+inputMgr = orxonox.InputManager:getInstance()
+
local schemeMgr = CEGUI.SchemeManager:getSingleton()
-winMgr = CEGUI.WindowManager:getSingleton()
-local logger = CEGUI.Logger:getSingleton()
-local system = CEGUI.System:getSingleton()
-local cursor = CEGUI.MouseCursor:getSingleton()
+local system = CEGUI.System:getSingleton()
+local cursor = CEGUI.MouseCursor:getSingleton()
schemeMgr:loadScheme("TaharezLookSkin.scheme")
-- load scheme with our own images
@@ -86,10 +88,12 @@
nrOfActiveSheets = nrOfActiveSheets - 1
else
if nrOfActiveSheets == 0 then
- orxonox.InputManager:getInstance():enterState("guiMouseOnly")
+ --orxonox.InputManager:getInstance():enterState("guiMouseOnly")
orxonox.HumanController:pauseControl()
end
end
+ orxonox.InputManager:getInstance():enterState(currentGUI.inputState)
+
nrOfActiveSheets = nrOfActiveSheets + 1
table.insert(activeSheets, filename)
activeSheets[nrOfActiveSheets] = filename
@@ -160,10 +164,11 @@
cursorVisibility[filename] = nil -- remove the cursor visibility of the current gui from the table
bHidePrevious[filename] = nil
if nrOfActiveSheets == 0 then
- orxonox.InputManager:getInstance():leaveState("guiMouseOnly")
+ --orxonox.InputManager:getInstance():leaveState("guiMouseOnly")
orxonox.HumanController:resumeControl()
hideCursor()
end
+ orxonox.InputManager:getInstance():leaveState(currentGUI.inputState)
end
function hideAllGUIs()
Modified: code/branches/gamestate/src/libraries/core/Core.cc
===================================================================
--- code/branches/gamestate/src/libraries/core/Core.cc 2010-03-16 10:22:36 UTC (rev 6536)
+++ code/branches/gamestate/src/libraries/core/Core.cc 2010-03-16 12:49:16 UTC (rev 6537)
@@ -224,8 +224,7 @@
inputManager_.reset(new InputManager());
// Load the CEGUI interface
- guiManager_.reset(new GUIManager(graphicsManager_->getRenderWindow(),
- inputManager_->getMousePosition(), graphicsManager_->isFullScreen()));
+ guiManager_.reset(new GUIManager(inputManager_->getMousePosition()));
bGraphicsLoaded_ = true;
GameMode::bShowsGraphics_s = true;
Modified: code/branches/gamestate/src/libraries/core/GUIManager.cc
===================================================================
--- code/branches/gamestate/src/libraries/core/GUIManager.cc 2010-03-16 10:22:36 UTC (rev 6536)
+++ code/branches/gamestate/src/libraries/core/GUIManager.cc 2010-03-16 12:49:16 UTC (rev 6537)
@@ -56,9 +56,13 @@
#include "util/OrxAssert.h"
#include "ConsoleCommand.h"
#include "Core.h"
+#include "GraphicsManager.h"
#include "LuaState.h"
#include "PathConfig.h"
#include "Resource.h"
+#include "input/InputManager.h"
+#include "input/InputState.h"
+#include "input/KeyBinderManager.h"
namespace orxonox
{
@@ -107,18 +111,16 @@
Ogre's render window. Without this, the GUI cannot be displayed.
@return true if success, otherwise false
*/
- GUIManager::GUIManager(Ogre::RenderWindow* renderWindow, const std::pair<int, int>& mousePosition, bool bFullScreen)
- : renderWindow_(renderWindow)
- , resourceProvider_(0)
+ GUIManager::GUIManager(const std::pair<int, int>& mousePosition)
+ : resourceProvider_(NULL)
, camera_(NULL)
- , bShowIngameGUI_(false)
{
using namespace CEGUI;
COUT(3) << "Initialising CEGUI." << std::endl;
// Note: No SceneManager specified yet
- guiRenderer_.reset(new OgreCEGUIRenderer(renderWindow_, Ogre::RENDER_QUEUE_OVERLAY, false, 3000));
+ guiRenderer_.reset(new OgreCEGUIRenderer(GraphicsManager::getInstance().getRenderWindow(), Ogre::RENDER_QUEUE_OVERLAY, false, 3000));
resourceProvider_ = guiRenderer_->createResourceProvider();
resourceProvider_->setDefaultResourceGroup("GUI");
@@ -140,15 +142,15 @@
// create the CEGUI system singleton
guiSystem_.reset(new System(guiRenderer_.get(), resourceProvider_, 0, scriptModule_.get()));
- // Initialise the basic Lua code
- this->luaState_->doFile("InitialiseGUI.lua");
-
// Align CEGUI mouse with OIS mouse
guiSystem_->injectMousePosition(mousePosition.first, mousePosition.second);
// Hide the mouse cursor unless playing in full screen mode
- if (!bFullScreen)
+ if (!GraphicsManager::getInstance().isFullScreen())
CEGUI::MouseCursor::getSingleton().hide();
+
+ // Initialise the basic Lua code
+ this->luaState_->doFile("InitialiseGUI.lua");
}
/**
@@ -250,6 +252,32 @@
GUIManager::getInstance().executeCode("hideGUI(\"" + name + "\")");
}
+ const std::string& GUIManager::createInputState(const std::string& name, TriBool::Value showMouse, TriBool::Value useKeyboard, bool bBlockJoyStick)
+ {
+ InputState* state = InputManager::getInstance().createInputState(name);
+
+ if (GraphicsManager::getInstance().isFullScreen() && showMouse == TriBool::True ||
+ !GraphicsManager::getInstance().isFullScreen() && showMouse == TriBool::False)
+ state->setMouseExclusive(TriBool::True);
+ else
+ state->setMouseExclusive(TriBool::Dontcare);
+
+ if (showMouse == TriBool::True)
+ state->setMouseHandler(this);
+ else if (showMouse == TriBool::False)
+ state->setMouseHandler(&InputHandler::EMPTY);
+
+ if (useKeyboard == TriBool::True)
+ state->setKeyHandler(this);
+ else if (useKeyboard == TriBool::False)
+ state->setKeyHandler(&InputHandler::EMPTY);
+
+ if (bBlockJoyStick)
+ state->setJoyStickHandler(&InputHandler::EMPTY);
+
+ return state->getName();
+ }
+
void GUIManager::keyESC()
{
this->executeCode("keyESC()");
Modified: code/branches/gamestate/src/libraries/core/GUIManager.h
===================================================================
--- code/branches/gamestate/src/libraries/core/GUIManager.h 2010-03-16 10:22:36 UTC (rev 6536)
+++ code/branches/gamestate/src/libraries/core/GUIManager.h 2010-03-16 12:49:16 UTC (rev 6537)
@@ -40,9 +40,15 @@
#include <boost/shared_ptr.hpp>
#include "util/OgreForwardRefs.h"
+#include "util/TriBool.h"
#include "util/Singleton.h"
#include "input/InputHandler.h"
+// Tolua includes (have to be relative to the current directory)
+/*
+$cfile "../util/TriBool.h" // tolua_export
+*/
+
namespace orxonox // tolua_export
{ // tolua_export
class PlayerInfo; // Forward declaration
@@ -53,7 +59,6 @@
Provides a simple interface to CEGUI with tolua methods and console commands. It also acts as a key and mouse handler.
The GUIManager is a singleton and can be called anywhere when access on the GUI is needed.
- Creation of the GUIManager is therefore not possible and the cunstructor is private.
Since the GUI needs user input, the GUIManager implements the functions needed to act as a key and/or mouse handler.
Those input events are then injected into CEGUI in Lua.
@@ -63,7 +68,7 @@
{ // tolua_export
friend class Singleton<GUIManager>;
public:
- GUIManager(Ogre::RenderWindow* renderWindow, const std::pair<int, int>& mousePosition, bool bFullScreen);
+ GUIManager(const std::pair<int, int>& mousePosition);
~GUIManager();
void preUpdate(const Clock& time);
@@ -75,11 +80,11 @@
void keyESC();
void setBackground(const std::string& name);
+ const std::string& createInputState(const std::string& name, TriBool::Value showMouse = TriBool::True, TriBool::Value useKeyboard = TriBool::True, bool bBlockJoyStick = false); // tolua_export
+
void setCamera(Ogre::Camera* camera);
Ogre::Camera* getCamera() { return this->camera_; }
- static GUIManager* getInstancePtr() { return singletonPtr_s; }
-
inline void setPlayer(const std::string& guiname, PlayerInfo* player)
{ this->players_[guiname] = player; }
inline PlayerInfo* getPlayer(const std::string& guiname) const
@@ -88,6 +93,8 @@
// TODO: Temporary hack because the tolua exported CEGUI method does not seem to work
static void subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function); //tolua_export
+ static GUIManager& getInstance() { return Singleton<GUIManager>::getInstance(); } // tolua_export
+
private:
GUIManager(const GUIManager& instance); //!< private and undefined copy c'tor (this is a singleton class)
@@ -102,20 +109,17 @@
void buttonReleased(MouseButtonCode::ByEnum id);
void mouseMoved (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
void mouseScrolled (int abs, int rel);
-
scoped_ptr<CEGUI::OgreCEGUIRenderer> guiRenderer_; //!< CEGUI's interface to the Ogre Engine
scoped_ptr<LuaState> luaState_; //!< LuaState, access point to the Lua engine
scoped_ptr<CEGUI::LuaScriptModule> scriptModule_; //!< CEGUI's script module to use Lua
scoped_ptr<CEGUI::System> guiSystem_; //!< CEGUI's main system
shared_ptr<ResourceInfo> rootFileInfo_; //!< Resource information about the root script
- Ogre::RenderWindow* renderWindow_; //!< Ogre's render window to give CEGUI access to it
CEGUI::ResourceProvider* resourceProvider_; //!< CEGUI's resource provider
CEGUI::Logger* ceguiLogger_; //!< CEGUI's logger to be able to log CEGUI errors in our log
- std::map<std::string, PlayerInfo*> players_; //!< Stores the player (owner) for each gui
+ std::map<std::string, PlayerInfo*> players_; //!< Stores the player (owner) for each GUI
Ogre::Camera* camera_; //!< Camera used to render the scene with the GUI
static GUIManager* singletonPtr_s; //!< Singleton reference to GUIManager
- bool bShowIngameGUI_;
}; // tolua_export
} // tolua_export
Modified: code/branches/gamestate/src/libraries/core/input/InputManager.cc
===================================================================
--- code/branches/gamestate/src/libraries/core/input/InputManager.cc 2010-03-16 10:22:36 UTC (rev 6536)
+++ code/branches/gamestate/src/libraries/core/input/InputManager.cc 2010-03-16 12:49:16 UTC (rev 6537)
@@ -86,7 +86,7 @@
: internalState_(Bad)
, oisInputManager_(0)
, devices_(2)
- , mouseMode_(MouseMode::Nonexclusive)
+ , exclusiveMouse_(TriBool::False)
, emptyState_(0)
, calibratorCallbackHandler_(0)
{
@@ -97,7 +97,7 @@
this->setConfigValues();
if (GraphicsManager::getInstance().isFullScreen())
- mouseMode_ = MouseMode::Exclusive;
+ exclusiveMouse_ = TriBool::True;
this->loadDevices();
// Lowest priority empty InputState
@@ -154,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 (mouseMode_ == MouseMode::Exclusive || GraphicsManager::getInstance().isFullScreen())
+ if (exclusiveMouse_ == TriBool::True || GraphicsManager::getInstance().isFullScreen())
{
// Disable Windows key plus special keys (like play, stop, next, etc.)
paramList.insert(std::make_pair("w32_keyboard", "DISCL_NOWINKEY"));
@@ -167,7 +167,7 @@
// Trouble might be that the Pressed event occurs a bit too often...
paramList.insert(std::make_pair("XAutoRepeatOn", "true"));
- if (mouseMode_ == MouseMode::Exclusive || GraphicsManager::getInstance().isFullScreen())
+ if (exclusiveMouse_ == TriBool::True || GraphicsManager::getInstance().isFullScreen())
{
if (CommandLineParser::getValue("keyboard_no_grab").getBool())
paramList.insert(std::make_pair("x11_keyboard_grab", "false"));
@@ -503,15 +503,15 @@
activeStatesTicked_.push_back(*it);
// Check whether we have to change the mouse mode
- MouseMode::Value requestedMode = MouseMode::Dontcare;
+ TriBool::Value requestedMode = TriBool::Dontcare;
std::vector<InputState*>& mouseStates = devices_[InputDeviceEnumerator::Mouse]->getStateListRef();
if (mouseStates.empty())
- requestedMode = MouseMode::Nonexclusive;
+ requestedMode = TriBool::False;
else
- requestedMode = mouseStates.front()->getMouseMode();
- if (requestedMode != MouseMode::Dontcare && mouseMode_ != requestedMode)
+ requestedMode = mouseStates.front()->getMouseExclusive();
+ if (requestedMode != TriBool::Dontcare && exclusiveMouse_ != requestedMode)
{
- mouseMode_ = requestedMode;
+ exclusiveMouse_ = requestedMode;
if (!GraphicsManager::getInstance().isFullScreen())
this->reloadInternal();
}
Modified: code/branches/gamestate/src/libraries/core/input/InputManager.h
===================================================================
--- code/branches/gamestate/src/libraries/core/input/InputManager.h 2010-03-16 10:22:36 UTC (rev 6536)
+++ code/branches/gamestate/src/libraries/core/input/InputManager.h 2010-03-16 12:49:16 UTC (rev 6537)
@@ -37,6 +37,7 @@
#include <vector>
#include "util/Singleton.h"
+#include "util/TriBool.h"
#include "core/WindowEventListener.h"
#include "InputState.h"
@@ -158,7 +159,7 @@
- You can't remove the internal states "empty", "calibrator" and "detector".
- The removal process is being postponed if InputManager::preUpdate() is currently running.
*/
- bool destroyState(const std::string& name);
+ bool destroyState(const std::string& name); // tolua_export
//-------------------------------
// Various getters and setters
@@ -195,7 +196,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)
- MouseMode::Value mouseMode_; //!< Currently applied mouse mode
+ TriBool::Value exclusiveMouse_; //!< Currently applied mouse mode
// some internally handled states and handlers
InputState* emptyState_; //!< Lowest priority states (makes handling easier)
Modified: code/branches/gamestate/src/libraries/core/input/InputState.cc
===================================================================
--- code/branches/gamestate/src/libraries/core/input/InputState.cc 2010-03-16 10:22:36 UTC (rev 6536)
+++ code/branches/gamestate/src/libraries/core/input/InputState.cc 2010-03-16 12:49:16 UTC (rev 6537)
@@ -36,7 +36,7 @@
: name_(name)
, bAlwaysGetsInput_(bAlwaysGetsInput)
, bTransparent_(bTransparent)
- , mouseMode_(MouseMode::Dontcare)
+ , exclusiveMouse_(TriBool::Dontcare)
, bExpired_(true)
, handlers_(2)
, joyStickHandlerAll_(0)
Modified: code/branches/gamestate/src/libraries/core/input/InputState.h
===================================================================
--- code/branches/gamestate/src/libraries/core/input/InputState.h 2010-03-16 10:22:36 UTC (rev 6536)
+++ code/branches/gamestate/src/libraries/core/input/InputState.h 2010-03-16 12:49:16 UTC (rev 6537)
@@ -36,6 +36,7 @@
#include <vector>
#include "util/OrxEnum.h"
+#include "util/TriBool.h"
#include "InputHandler.h"
#include "JoyStickQuantityListener.h"
@@ -55,15 +56,6 @@
static const int Detector = HighPriority + 2;
};
- namespace MouseMode
- {
- enum Value
- {
- Exclusive,
- Nonexclusive,
- Dontcare
- };
- }
/**
@brief
@@ -72,7 +64,7 @@
The general idea is a stack: Every activated InputState will be pushed on
that stack and only the top one gets the input events. This is done for
every device (keyboard, mouse, all joy sticks) separately to allow
- for intance keyboard input capturing for the console while you can still
+ for instance keyboard input capturing for the console while you can still
steer a ship with the mouse.
There are two exceptions to this behaviour though:
- If an InputState is created with the 'Transparent' parameter on, the
@@ -82,7 +74,7 @@
- If an InputState is created with the 'AlwaysGetsInput' parameter on, then
the state will always receive input as long as it is activated.
- Note: If you mark an InputState with both parameters on, then it will
- not influence ony other InputState at all.
+ not influence only other InputState at all.
@par Priorities
Every InputState has a priority when on the stack, but mostly this
@@ -94,7 +86,7 @@
@par Exclusive/Non-Exclusive mouse Mode
You can select a specific mouse mode that tells whether the application
- should have exclusive accessto it or not.
+ should have exclusive access to it or not.
When in non-exclusive mode, you can move the mouse out of the window
like with any other normal window (only for windowed mode!).
The setting is dictated by the topmost InputState that gets mouse events.
@@ -129,8 +121,8 @@
//! Sets an InputHandler to be used for all devices
void setHandler (InputHandler* handler);
- void setMouseMode(MouseMode::Value value) { mouseMode_ = value; this->bExpired_ = true; }
- MouseMode::Value getMouseMode() const { return mouseMode_; }
+ void setMouseExclusive(TriBool::Value value) { exclusiveMouse_ = value; this->bExpired_ = true; }
+ TriBool::Value getMouseExclusive() const { return exclusiveMouse_; }
//! Returns the name of the state (which is unique!)
const std::string& getName() const { return name_; }
@@ -183,7 +175,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
- MouseMode::Value mouseMode_; //!< See class declaration for explanation
+ TriBool::Value exclusiveMouse_; //!< 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
Added: code/branches/gamestate/src/libraries/util/TriBool.h
===================================================================
--- code/branches/gamestate/src/libraries/util/TriBool.h (rev 0)
+++ code/branches/gamestate/src/libraries/util/TriBool.h 2010-03-16 12:49:16 UTC (rev 6537)
@@ -0,0 +1,49 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _TriBool_H__
+#define _TriBool_H__
+
+#include "UtilPrereqs.h"
+
+// tolua_begin
+namespace orxonox
+{
+ namespace TriBool
+ {
+ enum Value
+ {
+ False = 0,
+ True = 1,
+ Dontcare = 2
+ };
+ }
+}
+// tolua_end
+
+#endif /* _TriBool_H__ */
Property changes on: code/branches/gamestate/src/libraries/util/TriBool.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/branches/gamestate/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/branches/gamestate/src/orxonox/gamestates/GSLevel.cc 2010-03-16 10:22:36 UTC (rev 6536)
+++ code/branches/gamestate/src/orxonox/gamestates/GSLevel.cc 2010-03-16 12:49:16 UTC (rev 6537)
@@ -68,16 +68,16 @@
if (GameMode::showsGraphics())
{
gameInputState_ = InputManager::getInstance().createInputState("game");
- gameInputState_->setMouseMode(MouseMode::Exclusive);
+ gameInputState_->setMouseExclusive(TriBool::True);
gameInputState_->setHandler(KeyBinderManager::getInstance().getDefaultAsHandler());
KeyBinderManager::getInstance().setToDefault();
guiMouseOnlyInputState_ = InputManager::getInstance().createInputState("guiMouseOnly");
- guiMouseOnlyInputState_->setMouseMode(MouseMode::Exclusive);
- guiMouseOnlyInputState_->setMouseHandler(GUIManager::getInstancePtr());
+ guiMouseOnlyInputState_->setMouseExclusive(TriBool::True);
+ guiMouseOnlyInputState_->setMouseHandler(&GUIManager::getInstance());
guiKeysOnlyInputState_ = InputManager::getInstance().createInputState("guiKeysOnly");
- guiKeysOnlyInputState_->setKeyHandler(GUIManager::getInstancePtr());
+ guiKeysOnlyInputState_->setKeyHandler(&GUIManager::getInstance());
}
if (GameMode::isMaster())
Modified: code/branches/gamestate/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- code/branches/gamestate/src/orxonox/gamestates/GSMainMenu.cc 2010-03-16 10:22:36 UTC (rev 6536)
+++ code/branches/gamestate/src/orxonox/gamestates/GSMainMenu.cc 2010-03-16 12:49:16 UTC (rev 6537)
@@ -52,8 +52,8 @@
{
RegisterRootObject(GSMainMenu);
inputState_ = InputManager::getInstance().createInputState("mainMenu");
- inputState_->setMouseMode(MouseMode::Nonexclusive);
- inputState_->setHandler(GUIManager::getInstancePtr());
+ inputState_->setMouseExclusive(TriBool::False);
+ inputState_->setHandler(&GUIManager::getInstance());
inputState_->setKeyHandler(KeyBinderManager::getInstance().getDefaultAsHandler());
inputState_->setJoyStickHandler(&InputHandler::EMPTY);
@@ -100,7 +100,7 @@
CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::setMainMenuSoundPath, this), "setMMSoundPath"));
KeyBinderManager::getInstance().setToDefault();
- InputManager::getInstance().enterState("mainMenu");
+ //InputManager::getInstance().enterState("mainMenu");
this->setConfigValues();
@@ -118,7 +118,7 @@
this->ambient_->stop();
}
- InputManager::getInstance().leaveState("mainMenu");
+ //InputManager::getInstance().leaveState("mainMenu");
GUIManager::getInstance().setCamera(0);
GUIManager::getInstance().setBackground("");
More information about the Orxonox-commit
mailing list