[Orxonox-commit 763] r3291 - in branches/core4/src: core core/input orxonox orxonox/gamestates orxonox/overlays orxonox/overlays/console

rgrieder at orxonox.net rgrieder at orxonox.net
Tue Jul 14 11:50:47 CEST 2009


Author: rgrieder
Date: 2009-07-14 11:50:47 +0200 (Tue, 14 Jul 2009)
New Revision: 3291

Modified:
   branches/core4/src/core/CorePrereqs.h
   branches/core4/src/core/WindowEventListener.cc
   branches/core4/src/core/WindowEventListener.h
   branches/core4/src/core/input/InputManager.cc
   branches/core4/src/core/input/InputManager.h
   branches/core4/src/core/input/JoyStickQuantityListener.h
   branches/core4/src/core/input/Mouse.cc
   branches/core4/src/core/input/Mouse.h
   branches/core4/src/orxonox/GraphicsManager.cc
   branches/core4/src/orxonox/OrxonoxPrereqs.h
   branches/core4/src/orxonox/gamestates/GSGraphics.cc
   branches/core4/src/orxonox/gamestates/GSGraphics.h
   branches/core4/src/orxonox/overlays/OrxonoxOverlay.cc
   branches/core4/src/orxonox/overlays/console/InGameConsole.cc
   branches/core4/src/orxonox/overlays/console/InGameConsole.h
Log:
Added window size as static variable to the WindowEventListener interface.
This resolves several hacks and inconveniences in Mouse, InputManager, InGameConsole, GSGraphics and OrxonoxOverlay.

Modified: branches/core4/src/core/CorePrereqs.h
===================================================================
--- branches/core4/src/core/CorePrereqs.h	2009-07-14 09:30:05 UTC (rev 3290)
+++ branches/core4/src/core/CorePrereqs.h	2009-07-14 09:50:47 UTC (rev 3291)
@@ -152,7 +152,7 @@
     struct TclInterpreterBundle;
     class TclThreadManager;
     class Template;
-    class Tickable;
+    class WindowEventListener;
     class XMLFile;
     class XMLNameListener;
     template <class T, class O>

Modified: branches/core4/src/core/WindowEventListener.cc
===================================================================
--- branches/core4/src/core/WindowEventListener.cc	2009-07-14 09:30:05 UTC (rev 3290)
+++ branches/core4/src/core/WindowEventListener.cc	2009-07-14 09:50:47 UTC (rev 3291)
@@ -31,8 +31,34 @@
 
 namespace orxonox
 {
+    unsigned int WindowEventListener::windowWidth_s  = 0;
+    unsigned int WindowEventListener::windowHeight_s = 0;
+
     WindowEventListener::WindowEventListener()
     {
         RegisterRootObject(WindowEventListener);
     }
+
+    //! Calls all registered objects
+    /*static*/ void WindowEventListener::moveWindow()
+    {
+        for (ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)
+            it->windowMoved();
+    }
+
+    //! Calls all registered objects and sets the static variables
+    /*static*/ void WindowEventListener::resizeWindow(unsigned int newWidth, unsigned int newHeight)
+    {
+        windowWidth_s = newWidth;
+        windowHeight_s = newHeight;
+        for (ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)
+            it->windowResized(newWidth, newHeight);
+    }
+
+    //! Calls all registered objects
+    /*static*/ void WindowEventListener::changeWindowFocus()
+    {
+        for (ObjectList<WindowEventListener>::iterator it = ObjectList<WindowEventListener>::begin(); it; ++it)
+            it->windowFocusChanged();
+    }
 }

Modified: branches/core4/src/core/WindowEventListener.h
===================================================================
--- branches/core4/src/core/WindowEventListener.h	2009-07-14 09:30:05 UTC (rev 3290)
+++ branches/core4/src/core/WindowEventListener.h	2009-07-14 09:50:47 UTC (rev 3291)
@@ -37,10 +37,18 @@
     //! Interface for receiving window events like resize, moved and focusChanged
     class _CoreExport WindowEventListener : virtual public OrxonoxClass
     {
-        public:
+        friend class OgreWindowEventListener;
+
+        protected:
             WindowEventListener();
             virtual ~WindowEventListener() { }
 
+            //! Returns the current render window width
+            unsigned int getWindowWidth() const { return windowWidth_s; }
+            //! Returns the current render window height
+            unsigned int getWindowHeight() const { return windowHeight_s; }
+
+        private:
             //! Window has been moved
             virtual void windowMoved() { }
 
@@ -49,6 +57,14 @@
 
             //! Window has lost/gained focus
             virtual void windowFocusChanged() { }
+
+            static void moveWindow();
+            static void resizeWindow(unsigned int newWidth, unsigned int newHeight);
+            static void changeWindowFocus();
+
+            //! Static variable that holds the latest distributed information
+            static unsigned int windowWidth_s;
+            static unsigned int windowHeight_s;
     };
 }
 

Modified: branches/core4/src/core/input/InputManager.cc
===================================================================
--- branches/core4/src/core/input/InputManager.cc	2009-07-14 09:30:05 UTC (rev 3290)
+++ branches/core4/src/core/input/InputManager.cc	2009-07-14 09:50:47 UTC (rev 3291)
@@ -81,7 +81,7 @@
     // #####                  Initialisation                  #####
     // ##########                                        ##########
     // ############################################################
-    InputManager::InputManager(size_t windowHnd, unsigned int windowWidth, unsigned int windowHeight)
+    InputManager::InputManager(size_t windowHnd)
         : internalState_(Bad)
         , oisInputManager_(0)
         , devices_(2)
@@ -99,7 +99,7 @@
 
         this->setConfigValues();
 
-        this->loadDevices(windowHnd, windowWidth, windowHeight);
+        this->loadDevices(windowHnd);
 
         // Lowest priority empty InputState
         emptyState_ = createInputState("empty", false, false, InputStatePriority::Empty);
@@ -156,7 +156,7 @@
     @param windowHeight
         The height of the render window
     */
-    void InputManager::loadDevices(size_t windowHnd, unsigned int windowWidth, unsigned int windowHeight)
+    void InputManager::loadDevices(size_t windowHnd)
     {
         CCOUT(3) << "Loading input devices..." << std::endl;
 
@@ -215,7 +215,7 @@
         }
 
         // TODO: Remove the two parameters
-        this->loadMouse(windowWidth, windowHeight);
+        this->loadMouse();
         this->loadJoySticks();
 
         // Reorder states in case some joy sticks were added/removed
@@ -225,13 +225,13 @@
     }
 
     //! Creates a new orxonox::Mouse
-    void InputManager::loadMouse(unsigned int windowWidth, unsigned int windowHeight)
+    void InputManager::loadMouse()
     {
         if (oisInputManager_->getNumberOfDevices(OIS::OISMouse) > 0)
         {
             try
             {
-                devices_[InputDeviceEnumerator::Mouse] = new Mouse(InputDeviceEnumerator::Mouse, oisInputManager_, windowWidth, windowHeight);
+                devices_[InputDeviceEnumerator::Mouse] = new Mouse(InputDeviceEnumerator::Mouse, oisInputManager_);
             }
             catch (const OIS::Exception& ex)
             {
@@ -367,17 +367,8 @@
     {
         CCOUT(3) << "Reloading ..." << std::endl;
 
-        // Save mouse clipping size
-        int clippingWidth = 800;
-        int clippingHeight = 600;
-        if (devices_[InputDeviceEnumerator::Mouse])
-        {
-            int clippingWidth  = static_cast<Mouse*>(devices_[InputDeviceEnumerator::Mouse])->getClippingWidth();
-            int clippingHeight = static_cast<Mouse*>(devices_[InputDeviceEnumerator::Mouse])->getClippingHeight();
-        }
-
         this->destroyDevices();
-        this->loadDevices(windowHnd_, clippingWidth, clippingHeight);
+        this->loadDevices(windowHnd_);
 
         internalState_ &= ~Bad;
         internalState_ &= ~ReloadRequest;
@@ -562,6 +553,12 @@
         COUT(0) << "Calibration has been stored." << std::endl;
     }
 
+    //! Gets called by WindowEventListener upon focus change --> clear buffers 
+    void InputManager::windowFocusChanged()
+    {
+        this->clearBuffers();
+    }
+
     // ############################################################
     // #####                    Iput States                   #####
     // ##########                                        ##########

Modified: branches/core4/src/core/input/InputManager.h
===================================================================
--- branches/core4/src/core/input/InputManager.h	2009-07-14 09:30:05 UTC (rev 3290)
+++ branches/core4/src/core/input/InputManager.h	2009-07-14 09:50:47 UTC (rev 3291)
@@ -36,7 +36,7 @@
 #include <string>
 #include <vector>
 
-#include "core/OrxonoxClass.h"
+#include "core/WindowEventListener.h"
 #include "InputState.h"
 
 namespace orxonox
@@ -61,7 +61,7 @@
         - Keyboard construction is mandatory , mouse and joy sticks are not.
           If the OIS::InputManager or the Keyboard fail, an exception is thrown.
     */
-    class _CoreExport InputManager : public OrxonoxClass
+    class _CoreExport InputManager : public WindowEventListener
     {
     public:
         //! Represents internal states of the InputManager.
@@ -81,7 +81,7 @@
             If either the OIS input system and/or the keyboard could not be created,
             the constructor fails with an std::exception.
         */
-        InputManager(size_t windowHnd, unsigned int windowWidth, unsigned int windowHeight);
+        InputManager(size_t windowHnd);
         //! Destroys all devices AND all input states!
         ~InputManager();
         void setConfigValues();
@@ -175,8 +175,8 @@
         InputManager(const InputManager&);
 
         // Intenal methods
-        void loadDevices(size_t windowHnd, unsigned int windowWidth, unsigned int windowHeight);
-        void loadMouse(unsigned int windowWidth, unsigned int windowHeight);
+        void loadDevices(size_t windowHnd);
+        void loadMouse();
         void loadJoySticks();
         void destroyDevices();
 
@@ -186,6 +186,9 @@
         void destroyStateInternal(InputState* state);
         void updateActiveStates();
 
+        // From WindowEventListener
+        void windowFocusChanged();
+
     private: // variables
         State                               internalState_;        //!< Current internal state
         OIS::InputManager*                  oisInputManager_;      //!< OIS input manager

Modified: branches/core4/src/core/input/JoyStickQuantityListener.h
===================================================================
--- branches/core4/src/core/input/JoyStickQuantityListener.h	2009-07-14 09:30:05 UTC (rev 3290)
+++ branches/core4/src/core/input/JoyStickQuantityListener.h	2009-07-14 09:50:47 UTC (rev 3291)
@@ -43,7 +43,7 @@
     class _CoreExport JoyStickQuantityListener : virtual public OrxonoxClass
     {
         friend InputManager;
-    public:
+    protected:
         JoyStickQuantityListener();
         virtual ~JoyStickQuantityListener() { }
 

Modified: branches/core4/src/core/input/Mouse.cc
===================================================================
--- branches/core4/src/core/input/Mouse.cc	2009-07-14 09:30:05 UTC (rev 3290)
+++ branches/core4/src/core/input/Mouse.cc	2009-07-14 09:50:47 UTC (rev 3291)
@@ -29,40 +29,39 @@
 #include "Mouse.h"
 
 #include <ois/OISMouse.h>
-#include "InputState.h"
 #include "core/ConsoleCommand.h"
+#include "core/CoreIncludes.h"
+#include "InputState.h"
 
-// HACK (include this as last, X11 seems to define some macros...)
 #ifdef ORXONOX_PLATFORM_LINUX
-#  include <ois/linux/LinuxMouse.h>
+// include this as last, X11 seems to define some macros...
+#include <ois/linux/LinuxMouse.h>
 #endif
 
 namespace orxonox
 {
-    Mouse::Mouse(unsigned int id, OIS::InputManager* oisInputManager, unsigned int windowWidth, unsigned int windowHeight)
+    Mouse::Mouse(unsigned int id, OIS::InputManager* oisInputManager)
         : super(id, oisInputManager)
     {
-        this->setMouseClipping(windowWidth, windowHeight);
-        // HACK:
-        instancePointer_s = this;
-    }
+        RegisterRootObject(Mouse);
+        this->windowResized(this->getWindowHeight(), this->getWindowHeight());
 
-    void Mouse::setMouseClipping(unsigned int width, unsigned int height)
-    {
-        oisDevice_->getMouseState().width  = width;
-        oisDevice_->getMouseState().height = height;
+#ifdef ORXONOX_PLATFORM_LINUX
+        {
+            // Mouse grab console command
+            FunctorMember<Mouse>* functor = createFunctor(&Mouse::grab);
+            functor->setObject(this);
+            this->getIdentifier()->addConsoleCommand(createConsoleCommand(functor, "grab"), false);
+        }
+        {
+            // Mouse ungrab console command
+            FunctorMember<Mouse>* functor = createFunctor(&Mouse::ungrab);
+            functor->setObject(this);
+            this->getIdentifier()->addConsoleCommand(createConsoleCommand(functor, "ungrab"), false);
+        }
+#endif
     }
 
-    unsigned int Mouse::getClippingWidth() const
-    {
-        return oisDevice_->getMouseState().width;
-    }
-
-    unsigned int Mouse::getClippingHeight() const
-    {
-        return oisDevice_->getMouseState().height;
-    }
-
     //! OIS event handler
     bool Mouse::mouseMoved(const OIS::MouseEvent &e)
     {
@@ -86,20 +85,13 @@
         return true;
     }
 
-    // ############################################################
-    // #####                   ugly hacks                     #####
-    // ##########                                        ##########
-    // ############################################################
+    void Mouse::windowResized(unsigned int newWidth, unsigned int newHeight)
+    {
+        oisDevice_->getMouseState().width  = newWidth;
+        oisDevice_->getMouseState().height = newHeight;
+    }
 
-    // HACK:
-    SetConsoleCommand(Mouse, setMouseClipping_s, false);
 #ifdef ORXONOX_PLATFORM_LINUX
-    SetConsoleCommand(Mouse, grabMouse, true);
-    SetConsoleCommand(Mouse, ungrabMouse, true);
-#endif
-    Mouse* Mouse::instancePointer_s = NULL;
-
-#ifdef ORXONOX_PLATFORM_LINUX
     void Mouse::grabMouse()
     {
         OIS::LinuxMouse* linuxMouse = dynamic_cast<OIS::LinuxMouse*>(instancePointer_s->oisDevice_);

Modified: branches/core4/src/core/input/Mouse.h
===================================================================
--- branches/core4/src/core/input/Mouse.h	2009-07-14 09:30:05 UTC (rev 3290)
+++ branches/core4/src/core/input/Mouse.h	2009-07-14 09:50:47 UTC (rev 3291)
@@ -30,7 +30,9 @@
 #define _Core_Mouse_H__
 
 #include "InputPrereqs.h"
+
 #include "InputDevice.h"
+#include "core/WindowEventListener.h"
 
 namespace orxonox
 {
@@ -52,6 +54,7 @@
     class _CoreExport Mouse
         : public InputDeviceTemplated<MouseTraits>
         , public OIS::MouseListener
+        , public WindowEventListener
     {
         friend class InputDeviceTemplated<MouseTraits>;
         //! Super class alias
@@ -59,30 +62,13 @@
 
     public:
         //! Only sets the clipping size. Initialising is done in the base class.
-        Mouse(unsigned int id, OIS::InputManager* oisInputManager, unsigned int windowWidth, unsigned int windowHeight);
+        Mouse(unsigned int id, OIS::InputManager* oisInputManager);
         ~Mouse() { }
 
-        /**
-        @brief
-            Adjusts the mouse window metrics.
-
-            This method has to be called every time the size of the window changes.
-        */
-        void setMouseClipping(unsigned int width, unsigned int height);
-        // Returns the width of the mouse window
-        unsigned int getClippingWidth() const;
-        // Returns the height of the mouse window
-        unsigned int getClippingHeight() const;
-
-        // HACK!
-        static void setMouseClipping_s(unsigned int width, unsigned int height)
-            { instancePointer_s->setMouseClipping(width, height); }
-        void setConfigValues() { }
 #ifdef ORXONOX_PLATFORM_LINUX
-        // HACK!
         // TODO: Make this a feature rather than a hack
-        static void grabMouse();
-        static void ungrabMouse();
+        void grabMouse();
+        void ungrabMouse();
 #endif
 
     private:
@@ -102,11 +88,10 @@
 
         bool mouseMoved(const OIS::MouseEvent &arg);
 
+        void windowResized(unsigned int newWidth, unsigned int newHeight);
+
         // Returns the class name as string
         static std::string getClassNameImpl() { return "Mouse"; }
-
-        // HACK:
-        static Mouse* instancePointer_s;
     };
 }
 

Modified: branches/core4/src/orxonox/GraphicsManager.cc
===================================================================
--- branches/core4/src/orxonox/GraphicsManager.cc	2009-07-14 09:30:05 UTC (rev 3290)
+++ branches/core4/src/orxonox/GraphicsManager.cc	2009-07-14 09:50:47 UTC (rev 3291)
@@ -74,10 +74,14 @@
 
     class _OrxonoxExport OgreWindowEventListener : public Ogre::WindowEventListener
     {
-        void windowResized     (Ogre::RenderWindow* rw);
-        void windowFocusChange (Ogre::RenderWindow* rw);
-        void windowClosed      (Ogre::RenderWindow* rw);
-        //void windowMoved       (Ogre::RenderWindow* rw);
+        void windowResized     (Ogre::RenderWindow* rw)
+            { orxonox::WindowEventListener::resizeWindow(rw->getWidth(), rw->getHeight()); }
+        void windowFocusChange (Ogre::RenderWindow* rw)
+            { orxonox::WindowEventListener::changeWindowFocus(); }
+        void windowClosed      (Ogre::RenderWindow* rw)
+            { orxonox::Game::getInstance().stop(); }
+        void windowMoved       (Ogre::RenderWindow* rw)
+            { orxonox::WindowEventListener::moveWindow(); }
     };
 
     GraphicsManager* GraphicsManager::singletonRef_s = 0;
@@ -417,24 +421,4 @@
        
         this->renderWindow_->writeContentsToTimestampedFile(Core::getLogPathString() + "screenShot_", ".jpg");
     }
-
-
-    /****** OgreWindowEventListener ******/
-
-    void OgreWindowEventListener::windowResized(Ogre::RenderWindow* rw)
-    {
-        for (ObjectList<orxonox::WindowEventListener>::iterator it
-            = ObjectList<orxonox::WindowEventListener>::begin(); it; ++it)
-            it->windowResized(rw->getWidth(), rw->getHeight());
-    }
-    void OgreWindowEventListener::windowFocusChange(Ogre::RenderWindow* rw)
-    {
-        for (ObjectList<orxonox::WindowEventListener>::iterator it
-            = ObjectList<orxonox::WindowEventListener>::begin(); it; ++it)
-            it->windowFocusChanged();
-    }
-    void OgreWindowEventListener::windowClosed(Ogre::RenderWindow* rw)
-    {
-        Game::getInstance().stop();
-    }
 }

Modified: branches/core4/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- branches/core4/src/orxonox/OrxonoxPrereqs.h	2009-07-14 09:30:05 UTC (rev 3290)
+++ branches/core4/src/orxonox/OrxonoxPrereqs.h	2009-07-14 09:50:47 UTC (rev 3291)
@@ -91,6 +91,7 @@
     // objects
     class Level;
     class Scene;
+    class Tickable;
 
     class AddQuest;
     class AddQuestHint;

Modified: branches/core4/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- branches/core4/src/orxonox/gamestates/GSGraphics.cc	2009-07-14 09:30:05 UTC (rev 3290)
+++ branches/core4/src/orxonox/gamestates/GSGraphics.cc	2009-07-14 09:50:47 UTC (rev 3291)
@@ -38,12 +38,10 @@
 #include <OgreRenderWindow.h>
 
 #include "util/Convert.h"
-#include "core/ConfigValueIncludes.h"
 #include "core/Clock.h"
 #include "core/CommandExecutor.h"
 #include "core/ConsoleCommand.h"
 #include "core/Core.h"
-#include "core/CoreIncludes.h"
 #include "core/Game.h"
 #include "core/GameMode.h"
 #include "core/input/InputManager.h"
@@ -71,7 +69,6 @@
         , masterInputState_(0)
         , debugOverlay_(0)
     {
-        RegisterRootObject(GSGraphics);
     }
 
     GSGraphics::~GSGraphics()
@@ -80,16 +77,6 @@
 
     /**
     @brief
-        this function does nothing
-
-        Indeed. Here goes nothing.
-    */
-    void GSGraphics::setConfigValues()
-    {
-    }
-
-    /**
-    @brief
         This function is called when we enter this game state.
 
         Since graphics is very important for our game this function does quite a lot:
@@ -107,8 +94,6 @@
     {
         GameMode::setShowsGraphics(true);
 
-        setConfigValues();
-
         // Load OGRE including the render window
         this->graphicsManager_ = new GraphicsManager();
 
@@ -123,7 +108,7 @@
         renderWindow->getCustomAttribute("WINDOW", &windowHnd);
 
         // Calls the InputManager which sets up the input devices.
-        inputManager_ = new InputManager(windowHnd, renderWindow->getWidth(), renderWindow->getHeight());
+        inputManager_ = new InputManager(windowHnd);
 
         // load master key bindings
         masterInputState_ = InputManager::getInstance().createInputState("master", true);
@@ -136,7 +121,7 @@
 
         // Load the InGameConsole
         console_ = new InGameConsole();
-        console_->initialise(renderWindow->getWidth(), renderWindow->getHeight());
+        console_->initialise();
 
         // load the CEGUI interface
         guiManager_ = new GUIManager();
@@ -232,34 +217,4 @@
         // Render
         this->graphicsManager_->update(time);
     }
-
-    /**
-    @brief
-        Window has resized.
-    @param rw
-        The render window it occured in
-    @note
-        GraphicsManager has a render window stored itself. This is the same
-        as rw. But we have to be careful when using multiple render windows!
-    */
-    void GSGraphics::windowResized(unsigned int newWidth, unsigned int newHeight)
-    {
-        // OIS needs this under linux even if we only use relative input measurement.
-        // HACK:
-        CommandExecutor::execute("setWindowExtents_s " + multi_cast<std::string>(newWidth) + " " + multi_cast<std::string>(newHeight));
-    }
-
-    /**
-    @brief
-        Window focus has changed.
-    @param rw
-        The render window it occured in
-    */
-    void GSGraphics::windowFocusChanged()
-    {
-        // instruct InputManager to clear the buffers (core library so we cannot use the interface)
-        if (this->inputManager_)
-            this->inputManager_->clearBuffers();
-    }
-
 }

Modified: branches/core4/src/orxonox/gamestates/GSGraphics.h
===================================================================
--- branches/core4/src/orxonox/gamestates/GSGraphics.h	2009-07-14 09:30:05 UTC (rev 3290)
+++ branches/core4/src/orxonox/gamestates/GSGraphics.h	2009-07-14 09:50:47 UTC (rev 3291)
@@ -36,9 +36,7 @@
 #define _GSGraphics_H__
 
 #include "OrxonoxPrereqs.h"
-
 #include "core/GameState.h"
-#include "core/WindowEventListener.h"
 
 namespace orxonox
 {
@@ -48,12 +46,11 @@
 
         This game state is only left out if we start a dedicated server where no graphics are present.
     */
-    class _OrxonoxExport GSGraphics : public GameState, public WindowEventListener
+    class _OrxonoxExport GSGraphics : public GameState
     {
     public:
         GSGraphics(const GameStateConstrParams& params);
         ~GSGraphics();
-        void setConfigValues();
 
         void activate();
         void deactivate();
@@ -62,10 +59,6 @@
         void toggleGUI();
 
     private:
-        // Window events from WindowEventListener
-        void windowResized(unsigned int newWidth, unsigned int newHeight);
-        void windowFocusChanged();
-
         // managed singletons
         InputManager*         inputManager_;        //!< Reference to input management
         InGameConsole*        console_;

Modified: branches/core4/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- branches/core4/src/orxonox/overlays/OrxonoxOverlay.cc	2009-07-14 09:30:05 UTC (rev 3290)
+++ branches/core4/src/orxonox/overlays/OrxonoxOverlay.cc	2009-07-14 09:50:47 UTC (rev 3291)
@@ -46,7 +46,6 @@
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
 #include "core/ConsoleCommand.h"
-#include "GraphicsManager.h"
 
 namespace orxonox
 {
@@ -80,8 +79,7 @@
         this->overlay_->add2D(this->background_);
 
         // Get aspect ratio from the render window. Later on, we get informed automatically
-        Ogre::RenderWindow* defaultWindow = GraphicsManager::getInstance().getRenderWindow();
-        this->windowAspectRatio_ = (float)defaultWindow->getWidth() / defaultWindow->getHeight();
+        this->windowAspectRatio_ = (float)this->getWindowWidth() / this->getWindowHeight();
         this->sizeCorrectionChanged();
 
         this->changedVisibility();

Modified: branches/core4/src/orxonox/overlays/console/InGameConsole.cc
===================================================================
--- branches/core4/src/orxonox/overlays/console/InGameConsole.cc	2009-07-14 09:30:05 UTC (rev 3290)
+++ branches/core4/src/orxonox/overlays/console/InGameConsole.cc	2009-07-14 09:50:47 UTC (rev 3291)
@@ -171,7 +171,7 @@
     /**
         @brief Initializes the InGameConsole.
     */
-    void InGameConsole::initialise(int windowWidth, int windowHeight)
+    void InGameConsole::initialise()
     {
         // create the corresponding input state
         inputState_ = InputManager::getInstance().createInputState("console", false, false, InputStatePriority::Console);
@@ -247,7 +247,7 @@
         // comment following line to disable noise
         this->consoleOverlayContainer_->addChild(this->consoleOverlayNoise_);
 
-        this->windowResized(windowWidth, windowHeight);
+        this->windowResized(this->getWindowWidth(), this->getWindowWidth());
 
         // move overlay "above" the top edge of the screen
         // we take -1.2 because the border makes the panel bigger

Modified: branches/core4/src/orxonox/overlays/console/InGameConsole.h
===================================================================
--- branches/core4/src/orxonox/overlays/console/InGameConsole.h	2009-07-14 09:30:05 UTC (rev 3290)
+++ branches/core4/src/orxonox/overlays/console/InGameConsole.h	2009-07-14 09:50:47 UTC (rev 3291)
@@ -45,7 +45,7 @@
         InGameConsole();
         ~InGameConsole();
 
-        void initialise(int windowWidth, int windowHeight);
+        void initialise();
         void destroy();
         void setConfigValues();
 




More information about the Orxonox-commit mailing list