[Orxonox-commit 5196] r9861 - code/branches/wiimote/src/libraries/core/input

georgr at orxonox.net georgr at orxonox.net
Mon Dec 2 16:37:11 CET 2013


Author: georgr
Date: 2013-12-02 16:37:11 +0100 (Mon, 02 Dec 2013)
New Revision: 9861

Modified:
   code/branches/wiimote/src/libraries/core/input/WiiMote.cc
Log:
3s of lag are still here...next try

Modified: code/branches/wiimote/src/libraries/core/input/WiiMote.cc
===================================================================
--- code/branches/wiimote/src/libraries/core/input/WiiMote.cc	2013-12-02 15:33:40 UTC (rev 9860)
+++ code/branches/wiimote/src/libraries/core/input/WiiMote.cc	2013-12-02 15:37:11 UTC (rev 9861)
@@ -16,18 +16,17 @@
 	      exit(0);
 		//else
 		  //orxout(user_warning) << "pointer is not null, yay" << std::endl;
-		if (PWii->Poll())
-		{
-			p->UpdateStatus();
-			//CWiimote::EventTypes e = p->GetEvent();
-			if(p->Buttons.isPressed(CButtons::BUTTON_A)||p->Buttons.isJustPressed(CButtons::BUTTON_A))
+		PWii->Poll();
+
+			p->UpdateStatus(); //perhaps this will help against the lag?
+			if(p->Buttons.isPressed(CButtons::BUTTON_A)||p->Buttons.isJustPressed(CButtons::BUTTON_A)) //ugly hack to just do something on button press easily
 				{
 					CommandExecutor::execute("fire 0", 0, 0);
 				}
 			Orientation o;
 
 			p->Accelerometer.GetOrientation(o.pitch, o.roll, o.yaw);
-			int x = (int)(500*(o.yaw-lastOrientation.yaw)/time.getDeltaTime());
+			int x = (int)(500*(o.yaw-lastOrientation.yaw)/time.getDeltaTime()); //get difference in orientation, divide by time to make faster movements result in faster orientation change
 			int y = (int)((o.pitch-lastOrientation.pitch)/time.getDeltaTime());
 			IntVector2 abs(0, 0);
 			IntVector2 rel(x, y);
@@ -38,9 +37,9 @@
 			if(x!=0 || y!=0)
 			{
 				for (unsigned int i = 0; i < inputStates_.size(); ++i)
-								inputStates_[i]->mouseMoved(abs, rel, clippingSize);
+								inputStates_[i]->mouseMoved(abs, rel, clippingSize); 	//pass random mouse movements to all input states
 			}
-		}
+		//}
 
 
 	}




More information about the Orxonox-commit mailing list