window resize


09-08-2008 15:31:06

What is the correct procedure to notify MyGui that the window has been resized? The GUI vanishes when I resize the window and I am not sure if it is MyGui or my own code doing something wrong. I am calling:

(Ogre::RederWindow* window)
and then

Or should MyGui do it automatically, and my own code is at fault (I am running it as a dll from a .net window in this case so its a bit unusual).


10-08-2008 04:23:47

You have to do that in your listener, normally, when you use MyGUI, you do it this way :

You create a class that inherits Ogre::WindowEventListener
for example ...

class LoadingListener :
public OIS::MouseListener,public Ogre::FrameListener, public OIS::KeyListener,public Ogre::WindowEventListener,public Ogre::ResourceGroupListener{

then, you define the method windowResized like this :

void LoadingListener::windowResized(Ogre::RenderWindow* rw){
ScreenWidth = rw->getWidth();
ScreenHeight = rw->getHeight();
//these are unsigned int

if (Core::getSingletonPtr()->Mouse){ // this is OIS::Mouse* Mouse, don't get confused by the getSingletonPtr() ....
const OIS::MouseState & ms = Core::getSingletonPtr()->Mouse->getMouseState();
ms.width = (int) ScreenWidth;
ms.height = (int) ScreenHeight;

and then you add the object as a window listener using ..


Assuming that Window is an Ogre::RenderWindow* and Loading is our class that inherited Ogre::WindowEventListener

Adieu ;)