[Orxonox-commit 3180] r7873 - code/trunk/src/libraries/core

landauf at orxonox.net landauf at orxonox.net
Sat Feb 12 21:10:41 CET 2011


Author: landauf
Date: 2011-02-12 21:10:41 +0100 (Sat, 12 Feb 2011)
New Revision: 7873

Modified:
   code/trunk/src/libraries/core/GUIManager.cc
   code/trunk/src/libraries/core/GUIManager.h
Log:
fixed mouse cursor offset after window resize

Modified: code/trunk/src/libraries/core/GUIManager.cc
===================================================================
--- code/trunk/src/libraries/core/GUIManager.cc	2011-02-12 18:40:56 UTC (rev 7872)
+++ code/trunk/src/libraries/core/GUIManager.cc	2011-02-12 20:10:41 UTC (rev 7873)
@@ -189,7 +189,7 @@
 
     void GUIManager::changedGUIScheme(void)
     {
-        
+
     }
 
     /**
@@ -497,4 +497,11 @@
         listbox->setItemTooltipsEnabled(enabled);
     }
 
+    /**
+        @brief Callback of window event listener, called if the window is resized. Sets the display size of CEGUI.
+    */
+    void GUIManager::windowResized(unsigned int newWidth, unsigned int newHeight)
+    {
+        this->guiRenderer_->setDisplaySize(CEGUI::Size(newWidth, newHeight));
+    }
 }

Modified: code/trunk/src/libraries/core/GUIManager.h
===================================================================
--- code/trunk/src/libraries/core/GUIManager.h	2011-02-12 18:40:56 UTC (rev 7872)
+++ code/trunk/src/libraries/core/GUIManager.h	2011-02-12 20:10:41 UTC (rev 7873)
@@ -49,6 +49,7 @@
 #include "util/Singleton.h"
 #include "input/InputHandler.h"
 #include "OrxonoxClass.h"
+#include "WindowEventListener.h"
 
 // Tolua includes (have to be relative to the current directory)
 /*
@@ -70,7 +71,7 @@
         Those input events are then injected into CEGUI in Lua.
     */
     class _CoreExport GUIManager // tolua_export
-        : public Singleton<GUIManager>, public InputHandler, public OrxonoxClass
+        : public Singleton<GUIManager>, public InputHandler, public WindowEventListener
     { // tolua_export
         friend class Singleton<GUIManager>;
     public:
@@ -131,6 +132,9 @@
         void mouseMoved    (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
         void mouseScrolled (int abs, int rel);
 
+        // window event handler
+        virtual void windowResized(unsigned int newWidth, unsigned int newHeight);
+
         scoped_ptr<CEGUI::OgreCEGUIRenderer> guiRenderer_;      //!< CEGUI's interface to the Ogre Engine
         scoped_ptr<LuaState>                 luaState_;         //!< LuaState, access point to the Lua engine
         scoped_ptr<CEGUI::LuaScriptModule>   scriptModule_;     //!< CEGUI's script module to use Lua




More information about the Orxonox-commit mailing list