[Orxonox-commit 789] r3310 - in branches/core4/src: core/input orxonox/gui

rgrieder at orxonox.net rgrieder at orxonox.net
Sun Jul 19 12:27:53 CEST 2009


Author: rgrieder
Date: 2009-07-19 12:27:53 +0200 (Sun, 19 Jul 2009)
New Revision: 3310

Modified:
   branches/core4/src/core/input/InputDevice.h
   branches/core4/src/core/input/InputManager.cc
   branches/core4/src/core/input/InputState.h
   branches/core4/src/core/input/Mouse.cc
   branches/core4/src/orxonox/gui/GUIManager.cc
Log:
Optimisations in the pathway of the input. Nobody will ever notice the difference in performance (immeasurable), but I love the beauty of having all my template code inlined when it even decreases code size (because the code gets inlined exactly once).

Modified: branches/core4/src/core/input/InputDevice.h
===================================================================
--- branches/core4/src/core/input/InputDevice.h	2009-07-19 09:12:13 UTC (rev 3309)
+++ branches/core4/src/core/input/InputDevice.h	2009-07-19 10:27:53 UTC (rev 3310)
@@ -180,7 +180,7 @@
 
     protected:
         //! Common code for all button pressed events (updates pressed buttons list and calls the input states)
-        void buttonPressed(ButtonTypeParam button)
+        FORCEINLINE void buttonPressed(ButtonTypeParam button)
         {
             // check whether the button already is in the list (can happen when focus was lost)
             unsigned int iButton = 0;
@@ -197,7 +197,7 @@
         }
 
         //! Common code for all button released events (updates pressed buttons list and calls the input states)
-        void buttonReleased(ButtonTypeParam button)
+        FORCEINLINE void buttonReleased(ButtonTypeParam button)
         {
             // remove the button from the pressedButtons_ list
             for (unsigned int iButton = 0; iButton < pressedButtons_.size(); iButton++)

Modified: branches/core4/src/core/input/InputManager.cc
===================================================================
--- branches/core4/src/core/input/InputManager.cc	2009-07-19 09:12:13 UTC (rev 3309)
+++ branches/core4/src/core/input/InputManager.cc	2009-07-19 10:27:53 UTC (rev 3310)
@@ -176,10 +176,10 @@
         windowHndStr << (unsigned int)windowHnd_;
         paramList.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
 #if defined(ORXONOX_PLATFORM_WINDOWS)
-        //paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE")));
-        //paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND")));
-        //paramList.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_NONEXCLUSIVE")));
-        //paramList.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_FOREGROUND")));
+        paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE")));
+        paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND")));
+        paramList.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_NONEXCLUSIVE")));
+        paramList.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_FOREGROUND")));
 #elif defined(ORXONOX_PLATFORM_LINUX)
         paramList.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));
         paramList.insert(std::make_pair(std::string("x11_mouse_grab"), "true"));

Modified: branches/core4/src/core/input/InputState.h
===================================================================
--- branches/core4/src/core/input/InputState.h	2009-07-19 09:12:13 UTC (rev 3309)
+++ branches/core4/src/core/input/InputState.h	2009-07-19 10:27:53 UTC (rev 3310)
@@ -173,14 +173,14 @@
         Functor*                    leaveFunctor_;          //!< Functor to be executed on leave
     };
 
-    inline void InputState::update(float dt)
+    FORCEINLINE void InputState::update(float dt)
     {
         for (unsigned int i = 0; i < handlers_.size(); ++i)
             if (handlers_[i] != NULL)
                 handlers_[i]->allDevicesUpdated(dt);
     }
 
-    inline void InputState::update(float dt, unsigned int device)
+    FORCEINLINE void InputState::update(float dt, unsigned int device)
     {
         switch (device)
         {
@@ -202,26 +202,26 @@
     }
 
     template <typename EventType, class Traits>
-    inline void InputState::buttonEvent(unsigned int device, const typename Traits::ButtonTypeParam button)
+    FORCEINLINE void InputState::buttonEvent(unsigned int device, const typename Traits::ButtonTypeParam button)
     {
         assert(device < handlers_.size());
         if (handlers_[device] != NULL)
             handlers_[device]->buttonEvent(device, button, EventType());
     }
 
-    inline void InputState::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
+    FORCEINLINE void InputState::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
     {
         if (handlers_[mouseIndex_s] != NULL)
             handlers_[mouseIndex_s]->mouseMoved(abs, rel, clippingSize);
     }
 
-    inline void InputState::mouseScrolled(int abs, int rel)
+    FORCEINLINE void InputState::mouseScrolled(int abs, int rel)
     {
         if (handlers_[mouseIndex_s] != NULL)
             handlers_[mouseIndex_s]->mouseScrolled(abs, rel);
     }
 
-    inline void InputState::joyStickAxisMoved(unsigned int device, unsigned int axis, float value)
+    FORCEINLINE void InputState::joyStickAxisMoved(unsigned int device, unsigned int axis, float value)
     {
         assert(device < handlers_.size());
         if (handlers_[device] != NULL)

Modified: branches/core4/src/core/input/Mouse.cc
===================================================================
--- branches/core4/src/core/input/Mouse.cc	2009-07-19 09:12:13 UTC (rev 3309)
+++ branches/core4/src/core/input/Mouse.cc	2009-07-19 10:27:53 UTC (rev 3310)
@@ -44,7 +44,7 @@
         : super(id, oisInputManager)
     {
         RegisterRootObject(Mouse);
-        this->windowResized(this->getWindowHeight(), this->getWindowHeight());
+        this->windowResized(this->getWindowWidth(), this->getWindowHeight());
 
 #ifdef ORXONOX_PLATFORM_LINUX
         {

Modified: branches/core4/src/orxonox/gui/GUIManager.cc
===================================================================
--- branches/core4/src/orxonox/gui/GUIManager.cc	2009-07-19 09:12:13 UTC (rev 3309)
+++ branches/core4/src/orxonox/gui/GUIManager.cc	2009-07-19 10:27:53 UTC (rev 3310)
@@ -419,7 +419,8 @@
 
     void GUIManager::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
     {
-        guiSystem_->injectMouseMove(static_cast<float>(rel.x), static_cast<float>(rel.y));
+        //guiSystem_->injectMouseMove(static_cast<float>(rel.x), static_cast<float>(rel.y));
+        guiSystem_->injectMousePosition(static_cast<float>(abs.x), static_cast<float>(abs.y));
     }
     void GUIManager::mouseScrolled(int abs, int rel)
     {




More information about the Orxonox-commit mailing list