[Orxonox-commit 5059] r9723 - code/branches/wiimote/src/libraries/core/input

georgr at orxonox.net georgr at orxonox.net
Mon Oct 28 16:07:58 CET 2013


Author: georgr
Date: 2013-10-28 16:07:58 +0100 (Mon, 28 Oct 2013)
New Revision: 9723

Added:
   code/branches/wiimote/src/libraries/core/input/WiiMote.cc
   code/branches/wiimote/src/libraries/core/input/WiiMote.h
Modified:
   code/branches/wiimote/src/libraries/core/input/CMakeLists.txt
   code/branches/wiimote/src/libraries/core/input/InputManager.cc
   code/branches/wiimote/src/libraries/core/input/InputManager.h
Log:
New way to output insulting messages \o/


Modified: code/branches/wiimote/src/libraries/core/input/CMakeLists.txt
===================================================================
--- code/branches/wiimote/src/libraries/core/input/CMakeLists.txt	2013-10-28 15:01:23 UTC (rev 9722)
+++ code/branches/wiimote/src/libraries/core/input/CMakeLists.txt	2013-10-28 15:07:58 UTC (rev 9723)
@@ -13,4 +13,5 @@
   KeyDetector.cc
   Mouse.cc
   Wiimote_Test.cc
+  WiiMote.cc
 )

Modified: code/branches/wiimote/src/libraries/core/input/InputManager.cc
===================================================================
--- code/branches/wiimote/src/libraries/core/input/InputManager.cc	2013-10-28 15:01:23 UTC (rev 9722)
+++ code/branches/wiimote/src/libraries/core/input/InputManager.cc	2013-10-28 15:07:58 UTC (rev 9723)
@@ -57,6 +57,8 @@
 #include "Mouse.h"
 #include "Keyboard.h"
 
+#include "WiiMote.h"
+
 namespace orxonox
 {
     SetCommandLineSwitch(keyboard_no_grab).information("Whether not to exclusively grab the keyboard");
@@ -217,10 +219,20 @@
 
         // Reorder states in case some joy sticks were added/removed
         this->updateActiveStates();
-
+        this->loadWiiMote();
         orxout(verbose, context::input) << "Input devices loaded." << endl;
     }
-
+    void InputManager::loadWiiMote()
+    {
+    	try
+    	{
+    		devices_.push_back(new WiiMote(234));
+    	}
+    	catch(std::exception& e)  //gotta catch em all
+    	{
+    		orxout()<<"Exception loading WiiMote!!!1!11!";
+    	}
+    }
     //! Creates a new orxonox::Mouse
     void InputManager::loadMouse()
     {

Modified: code/branches/wiimote/src/libraries/core/input/InputManager.h
===================================================================
--- code/branches/wiimote/src/libraries/core/input/InputManager.h	2013-10-28 15:01:23 UTC (rev 9722)
+++ code/branches/wiimote/src/libraries/core/input/InputManager.h	2013-10-28 15:07:58 UTC (rev 9723)
@@ -36,10 +36,13 @@
 #include <vector>
 #include <boost/function.hpp>
 
+
 #include "util/Singleton.h"
 #include "util/tribool.h"
 #include "core/WindowEventListener.h"
 
+
+
 // tolua_begin
 namespace orxonox
 {
@@ -196,6 +199,7 @@
 
         // Internal methods
         void loadDevices();
+        void loadWiiMote();
         void loadMouse();
         void loadJoySticks();
         void destroyDevices();

Added: code/branches/wiimote/src/libraries/core/input/WiiMote.cc
===================================================================
--- code/branches/wiimote/src/libraries/core/input/WiiMote.cc	                        (rev 0)
+++ code/branches/wiimote/src/libraries/core/input/WiiMote.cc	2013-10-28 15:07:58 UTC (rev 9723)
@@ -0,0 +1,25 @@
+#include "WiiMote.h"
+#include "core/CoreIncludes.h"
+#include "core/command/ConsoleCommand.h"
+
+namespace orxonox
+{
+
+	const std::string WiiMote::deviceName = "WiiMote";
+	void WiiMote::update(const Clock& time)
+	{
+		orxout()<<"fegit";
+
+	}
+	void WiiMote::clearBuffers()
+	{
+
+	}
+	void WiiMote::test(int x, int y)
+	{
+
+	}
+	WiiMote::WiiMote(unsigned int id)  : InputDevice(id)
+	{
+	}
+}

Added: code/branches/wiimote/src/libraries/core/input/WiiMote.h
===================================================================
--- code/branches/wiimote/src/libraries/core/input/WiiMote.h	                        (rev 0)
+++ code/branches/wiimote/src/libraries/core/input/WiiMote.h	2013-10-28 15:07:58 UTC (rev 9723)
@@ -0,0 +1,32 @@
+
+#include "InputDevice.h"
+//#include "InputState.h"
+//#include "InputManager.h"
+
+
+
+namespace orxonox
+{
+	class WiiMote : public InputDevice
+	{
+	 public:
+			//! Only resets the members
+        	WiiMote(unsigned int id);
+        	~WiiMote() { }
+	        //! Returns the device class (derived) name as string
+	        std::string getClassName() const {return deviceName;}
+	        //! Updates the device which should in turn distribute events
+	        void update(const Clock& time);
+	        //! Clear all button related buffers
+	        void clearBuffers();
+
+	 protected:
+	         void calibrationStarted() { }
+	         void calibrationStopped() { }
+	         //! List of all input states that receive events from this device
+	         std::vector<InputState*> inputStates_;
+	 private:
+	         static const std::string deviceName;
+	         void test(int x, int y);
+	};
+};




More information about the Orxonox-commit mailing list