[Orxonox-commit 423] r3005 - branches/netp3/src/core/input

rgrieder at orxonox.net rgrieder at orxonox.net
Thu May 21 11:57:53 CEST 2009


Author: rgrieder
Date: 2009-05-21 11:57:52 +0200 (Thu, 21 May 2009)
New Revision: 3005

Modified:
   branches/netp3/src/core/input/InputManager.cc
   branches/netp3/src/core/input/InputManager.h
Log:
Ugly hacking for a nearing presentation ^^
You should now be able to grab and ungrab the mouse under linux (totally not tested since I'm using windows)

Modified: branches/netp3/src/core/input/InputManager.cc
===================================================================
--- branches/netp3/src/core/input/InputManager.cc	2009-05-20 23:18:46 UTC (rev 3004)
+++ branches/netp3/src/core/input/InputManager.cc	2009-05-21 09:57:52 UTC (rev 3005)
@@ -41,6 +41,11 @@
 #include "ois/OISException.h"
 #include "ois/OISInputManager.h"
 
+// HACK
+#ifdef ORXONOX_PLATFORM_LINUX
+#  include "ois/linux/LinuxMouse.h"
+#endif
+
 #include "util/Exception.h"
 #include "core/Clock.h"
 #include "core/CoreIncludes.h"
@@ -1468,4 +1473,26 @@
     {
         getInstance().reloadInputSystem(joyStickSupport);
     }
+
+
+    // ############################################################
+    // #####                   ugly hacks                     #####
+    // ##########                                        ##########
+    // ############################################################
+
+#ifdef ORXONOX_PLATFORM_LINUX
+    void InputManager::grabMouse()
+    {
+        OIS::LinuxMouse* linuxMouse = dynamic_cast<OIS::LinuxMouse*>(this->mouse_);
+        assert(linuxMouse);
+        linuxMouse->grab(true);
+    }
+
+    void InputManager::ungrabMouse()
+    {
+        OIS::LinuxMouse* linuxMouse = dynamic_cast<OIS::LinuxMouse*>(this->mouse_);
+        assert(linuxMouse);
+        linuxMouse->grab(false);
+    }
+#endif
 }

Modified: branches/netp3/src/core/input/InputManager.h
===================================================================
--- branches/netp3/src/core/input/InputManager.h	2009-05-20 23:18:46 UTC (rev 3004)
+++ branches/netp3/src/core/input/InputManager.h	2009-05-21 09:57:52 UTC (rev 3005)
@@ -137,6 +137,12 @@
         bool requestEnterState     (const std::string& name);
         bool requestLeaveState     (const std::string& name);
 
+#ifdef ORXONOX_PLATFORM_LINUX
+        // HACK!
+        void grabMouse();
+        void ungrabMouse();
+#endif
+
         void update(const Clock& time);
 
         static InputManager& getInstance()    { assert(singletonRef_s); return *singletonRef_s; }




More information about the Orxonox-commit mailing list