[Orxonox-commit 5140] r9805 - code/branches/wiimote/src/libraries/core/input

smerkli at orxonox.net smerkli at orxonox.net
Sun Nov 24 11:15:46 CET 2013


Author: smerkli
Date: 2013-11-24 11:15:46 +0100 (Sun, 24 Nov 2013)
New Revision: 9805

Modified:
   code/branches/wiimote/src/libraries/core/input/InputManager.cc
   code/branches/wiimote/src/libraries/core/input/InputState.cc
   code/branches/wiimote/src/libraries/core/input/InputState.h
   code/branches/wiimote/src/libraries/core/input/WiiMote.h
   code/branches/wiimote/src/libraries/core/input/Wiimote_Test.cc
Log:
- Converted some absolute paths into relative ones
- Increased the handlers_ vector size by 1 as a hack to get the 
  wiimote working in this branch (This will have to be cleanly
  redone once I have a better concept for wiimotes and joysticks)
- Removed a local inputStates_ variable that georgr added in wiimote,
  it shadowed the one from the basis class and hence never got any
  entries

To be discussed with georgr on monday. 



Modified: code/branches/wiimote/src/libraries/core/input/InputManager.cc
===================================================================
--- code/branches/wiimote/src/libraries/core/input/InputManager.cc	2013-11-21 22:44:16 UTC (rev 9804)
+++ code/branches/wiimote/src/libraries/core/input/InputManager.cc	2013-11-24 10:15:46 UTC (rev 9805)
@@ -253,17 +253,18 @@
 
 
     	}
-   	    try
-   	    {
-   	    	orxout()<<devices_.size();
-   	  	    devices_.push_back(new WiiMote(devices_.size(), *(new CWiimote())));
-   	    	//devices_[2] = new WiiMote(devices_.size(), *(new CWiimote()));
+            try
+            {
+              orxout()<< "Size of devices vector before wiimote insertion:" << devices_.size() << std::endl;
+              devices_.push_back(new WiiMote(devices_.size(), *(new CWiimote())));
+              //devices_[2] = new WiiMote(devices_.size(), *(new CWiimote()));
+              orxout()<< "Size of devices vector after wiimote insertion:" << devices_.size() << std::endl;
 
-   	    }
-   	    catch(std::exception& e)  //gotta catch em all
-   	    {
-   	   	      orxout()<<"Exception loading WiiMote!!!1!11!";
-   	    }
+            }
+            catch(std::exception& e)  //gotta catch em all
+            {
+              orxout()<<"Exception loading WiiMote!!!1!11!";
+            }
 
     }
     //! Creates a new orxonox::Mouse
@@ -474,7 +475,7 @@
             	orxout() << "Checking condition 3: " << !occupied <<std::endl;
             	if (rit->second->isInputDeviceEnabled(i) && (!occupied || rit->second->bAlwaysGetsInput_))
                 {
-                	orxout() << "Success with ID " << i <<std::endl;
+                    orxout() << "Success with ID " << i <<std::endl;
                     states.push_back(rit->second);
                     if (!rit->second->bTransparent_)
                         occupied = true;

Modified: code/branches/wiimote/src/libraries/core/input/InputState.cc
===================================================================
--- code/branches/wiimote/src/libraries/core/input/InputState.cc	2013-11-21 22:44:16 UTC (rev 9804)
+++ code/branches/wiimote/src/libraries/core/input/InputState.cc	2013-11-24 10:15:46 UTC (rev 9805)
@@ -48,7 +48,10 @@
         else
             priority_ = 0;
 
-        handlers_.resize(InputDeviceEnumerator::FirstJoyStick + this->getJoyStickList().size(), NULL);
+        // SANDRO HACK: make this 1 larger so we can have the wiimote read out as well
+        //handlers_.resize(InputDeviceEnumerator::FirstJoyStick + this->getJoyStickList().size(), NULL);
+        handlers_.resize(InputDeviceEnumerator::FirstJoyStick 
+          + 1 +  this->getJoyStickList().size(), NULL);
     }
 
     bool InputState::isInputDeviceEnabled(unsigned int device)
@@ -97,6 +100,7 @@
         setKeyHandler(handler);
         setMouseHandler(handler);
         setJoyStickHandler(handler);
+        setWiiMoteHandler(handler); // SANDRO HACK
     }
 
     void InputState::entered()

Modified: code/branches/wiimote/src/libraries/core/input/InputState.h
===================================================================
--- code/branches/wiimote/src/libraries/core/input/InputState.h	2013-11-21 22:44:16 UTC (rev 9804)
+++ code/branches/wiimote/src/libraries/core/input/InputState.h	2013-11-24 10:15:46 UTC (rev 9805)
@@ -99,6 +99,13 @@
         //! Sets the mouse event handler (overwrites if there already was one!)
         void setMouseHandler   (InputHandler* handler)
             { handlers_[mouseIndex_s]    = handler; bExpired_ = true; }
+
+        // SANDRO HACK
+        void setWiiMoteHandler(InputHandler* handler)
+        { // TODO make this a dynamically chosen number
+          handlers_[2]    = handler; bExpired_ = true;
+        }
+
         /**
         @brief
             Sets the joy stick event handler for one specific joy stick (overwrites if there already was one!)

Modified: code/branches/wiimote/src/libraries/core/input/WiiMote.h
===================================================================
--- code/branches/wiimote/src/libraries/core/input/WiiMote.h	2013-11-21 22:44:16 UTC (rev 9804)
+++ code/branches/wiimote/src/libraries/core/input/WiiMote.h	2013-11-24 10:15:46 UTC (rev 9805)
@@ -30,7 +30,7 @@
 	         void calibrationStarted() { }
 	         void calibrationStopped() { }
 	         //! List of all input states that receive events from this device
-	         std::vector<InputState*> inputStates_;
+		 //std::vector<InputState*> inputStates_;
 
 	 private:
 	         static const std::string deviceName;

Modified: code/branches/wiimote/src/libraries/core/input/Wiimote_Test.cc
===================================================================
--- code/branches/wiimote/src/libraries/core/input/Wiimote_Test.cc	2013-11-21 22:44:16 UTC (rev 9804)
+++ code/branches/wiimote/src/libraries/core/input/Wiimote_Test.cc	2013-11-24 10:15:46 UTC (rev 9805)
@@ -5,14 +5,13 @@
  *      Author: georgr
  */
 
-#include "/usr/tardis/home-itet-ab/georgr-extra-0/orxonox/wiimote/src/libraries/core/input/Wiimote_Test.h"
+#include "Wiimote_Test.h"
 #include "core/CoreIncludes.h"
 #include "core/command/ConsoleCommand.h"
 #include "InputState.h"
-#include </usr/tardis/home-itet-ab/georgr-extra-0/orxonox/wiimote/src/orxonox/OrxonoxPrereqs.h>
 #include "InputManager.h"
-#include </usr/tardis/home-itet-ab/georgr-extra-0/orxonox/wiimote/src/libraries/util/UtilPrereqs.h>
-#include </usr/tardis/home-itet-ab/georgr-extra-0/orxonox/wiimote/src/libraries/util/ScopedSingletonManager.h>
+#include <util/UtilPrereqs.h>
+#include <util/ScopedSingletonManager.h>
 
 
 namespace orxonox




More information about the Orxonox-commit mailing list