[Orxonox-commit 2028] r6745 - code/branches/gamestates2/src/libraries/core/input

rgrieder at orxonox.net rgrieder at orxonox.net
Fri Apr 16 13:42:28 CEST 2010


Author: rgrieder
Date: 2010-04-16 13:42:28 +0200 (Fri, 16 Apr 2010)
New Revision: 6745

Modified:
   code/branches/gamestates2/src/libraries/core/input/InputDevice.h
   code/branches/gamestates2/src/libraries/core/input/InputHandler.h
   code/branches/gamestates2/src/libraries/core/input/InputState.h
Log:
Branch now compiling with GCC as well: Added an removed a few typenames and other stuff

Modified: code/branches/gamestates2/src/libraries/core/input/InputDevice.h
===================================================================
--- code/branches/gamestates2/src/libraries/core/input/InputDevice.h	2010-04-16 11:41:25 UTC (rev 6744)
+++ code/branches/gamestates2/src/libraries/core/input/InputDevice.h	2010-04-16 11:42:28 UTC (rev 6745)
@@ -158,7 +158,7 @@
             // Call all the states with the held button event
             for (unsigned int iB = 0; iB < pressedButtons_.size(); ++iB)
                 for (unsigned int iS = 0; iS < inputStates_.size(); ++iS)
-                    inputStates_[iS]->buttonEvent<ButtonEvent::THold, Traits::ButtonTypeParam>(
+                    inputStates_[iS]->buttonEvent<ButtonEvent::THold, typename Traits::ButtonTypeParam>(
                         this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(pressedButtons_[iB]));
 
             // Call states with device update events
@@ -195,7 +195,7 @@
 
             // Call states
             for (unsigned int i = 0; i < inputStates_.size(); ++i)
-                inputStates_[i]->buttonEvent<ButtonEvent::TPress, Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
+                inputStates_[i]->buttonEvent<ButtonEvent::TPress, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
         }
 
         //! Common code for all button released events (updates pressed buttons list and calls the input states)
@@ -217,7 +217,7 @@
 
             // Call states
             for (unsigned int i = 0; i < inputStates_.size(); ++i)
-                inputStates_[i]->buttonEvent<ButtonEvent::TRelease, Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
+                inputStates_[i]->buttonEvent<ButtonEvent::TRelease, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
         }
 
         //! Managed pointer to the OIS device

Modified: code/branches/gamestates2/src/libraries/core/input/InputHandler.h
===================================================================
--- code/branches/gamestates2/src/libraries/core/input/InputHandler.h	2010-04-16 11:41:25 UTC (rev 6744)
+++ code/branches/gamestates2/src/libraries/core/input/InputHandler.h	2010-04-16 11:42:28 UTC (rev 6745)
@@ -117,12 +117,6 @@
             { this->buttonReleased(button); }
         template<class T> void buttonEvent(unsigned int device, T button, ButtonEvent::THold)
             { this->buttonHeld(button); }
-        template<> void buttonEvent<JoyStickButtonCode::ByEnum>(unsigned int device, JoyStickButtonCode::ByEnum button, ButtonEvent::TPress)
-            { this->buttonPressed(device - InputDeviceEnumerator::FirstJoyStick, button); }
-        template<> void buttonEvent<JoyStickButtonCode::ByEnum>(unsigned int device, JoyStickButtonCode::ByEnum button, ButtonEvent::TRelease)
-            { this->buttonReleased(device - InputDeviceEnumerator::FirstJoyStick, button); }
-        template<> void buttonEvent<JoyStickButtonCode::ByEnum>(unsigned int device, JoyStickButtonCode::ByEnum button, ButtonEvent::THold)
-            { this->buttonHeld(device - InputDeviceEnumerator::FirstJoyStick, button); }
 
         virtual void buttonPressed (const KeyEvent& evt) { }
         virtual void buttonReleased(const KeyEvent& evt) { }
@@ -148,6 +142,13 @@
         //! Use this input handler if you want to occupy a device in an input state.
         static InputHandler EMPTY;
     };
+
+    template<> inline void InputHandler::buttonEvent<JoyStickButtonCode::ByEnum>(unsigned int device, JoyStickButtonCode::ByEnum button, ButtonEvent::TPress)
+        { this->buttonPressed(device - InputDeviceEnumerator::FirstJoyStick, button); }
+    template<> inline void InputHandler::buttonEvent<JoyStickButtonCode::ByEnum>(unsigned int device, JoyStickButtonCode::ByEnum button, ButtonEvent::TRelease)
+        { this->buttonReleased(device - InputDeviceEnumerator::FirstJoyStick, button); }
+    template<> inline void InputHandler::buttonEvent<JoyStickButtonCode::ByEnum>(unsigned int device, JoyStickButtonCode::ByEnum button, ButtonEvent::THold)
+        { this->buttonHeld(device - InputDeviceEnumerator::FirstJoyStick, button); }
 }
 
 #endif /* _InputHandler_H__ */

Modified: code/branches/gamestates2/src/libraries/core/input/InputState.h
===================================================================
--- code/branches/gamestates2/src/libraries/core/input/InputState.h	2010-04-16 11:41:25 UTC (rev 6744)
+++ code/branches/gamestates2/src/libraries/core/input/InputState.h	2010-04-16 11:42:28 UTC (rev 6745)
@@ -204,7 +204,7 @@
     }
 
     template <typename EventType, class ButtonTypeParam>
-    FORCEINLINE void InputState::buttonEvent(unsigned int device, typename ButtonTypeParam button)
+    FORCEINLINE void InputState::buttonEvent(unsigned int device, ButtonTypeParam button)
     {
         assert(device < handlers_.size());
         if (handlers_[device] != NULL)




More information about the Orxonox-commit mailing list