[Orxonox-commit 1583] r6301 - code/branches/presentation2/src/libraries/core/input

rgrieder at orxonox.net rgrieder at orxonox.net
Wed Dec 9 20:42:57 CET 2009


Author: rgrieder
Date: 2009-12-09 20:42:56 +0100 (Wed, 09 Dec 2009)
New Revision: 6301

Modified:
   code/branches/presentation2/src/libraries/core/input/InputDevice.h
Log:
Changed an input strategy: When you press a key but don't release it and then clear the input buffer, the release event will not be triggered anymore.

Modified: code/branches/presentation2/src/libraries/core/input/InputDevice.h
===================================================================
--- code/branches/presentation2/src/libraries/core/input/InputDevice.h	2009-12-09 19:39:42 UTC (rev 6300)
+++ code/branches/presentation2/src/libraries/core/input/InputDevice.h	2009-12-09 19:42:56 UTC (rev 6301)
@@ -202,14 +202,18 @@
         FORCEINLINE void buttonReleased(ButtonTypeParam button)
         {
             // remove the button from the pressedButtons_ list
+            bool found = false;
             for (unsigned int iButton = 0; iButton < pressedButtons_.size(); iButton++)
             {
                 if (pressedButtons_[iButton] == button)
                 {
                     pressedButtons_.erase(pressedButtons_.begin() + iButton);
+                    found = true;
                     break;
                 }
             }
+            if (!found)
+                return; // We ignore release strokes when the press was not captured
 
             // Call states
             for (unsigned int i = 0; i < inputStates_.size(); ++i)




More information about the Orxonox-commit mailing list