main window resize

dbx

14-06-2010 14:46:05

A small question related to app resize:

In my application i need to keep a strict correspondence between the MyGUI cursor and the windows one.
As long as i don't resize the app window everything goes fine, but when i resize it MyGUI keep the old dimensions when dealing with the cursor position.

For instance, at startup my window app is located in x=5,y=5, with width=1024, height=576.
I resize the window to 1303x694, and then, if i move the MyGUI cursor to the bottom-right corner it still says that the cursor position is 1024,576 and not 1303,694.

Any way to correct this?

Thanks.

Altren

14-06-2010 17:15:36

It depends on how you do window resizing. In MyGUI demos OgrePlatform is Ogre::WindowEventListener and it handle windowResized event. In your application it's probably never called.

dbx

15-06-2010 10:32:37

It depends on how you do window resizing. In MyGUI demos OgrePlatform is Ogre::WindowEventListener and it handle windowResized event. In your application it's probably never called.

I do this:

When i get a WM_SIZE message i do the following:

1-Notify ogre : m_pRenderWindow->windowMovedOrResized();
2-Update ogre active camera aspect ratio : m_pGUICamera->setAspectRatio((Ogre::Real)pOgre.m_pRenderWindow->getWidth() / (Ogre::Real)pOgre.m_pRenderWindow->getHeight());
3-Inform OIS of the new dimensions ( const OIS::MouseState &ms=m_pMouse->getMouseState(); ms.width=m_pRenderWindow->getWidth(); ms.height=m_pRenderWindow->getHeight(); )
4-i also do this : m_pGUI->resizeWindow(MyGUI::IntSize(m_pRenderWindow->getWidth(),m_pRenderWindow->getHeight())); but it's mostly useless, i've tried not using this last one but nothing really changes.

Everything is resized corretly ( even the GUI buttons etc...) and numerically the MyGUI cursor correspond to the window cursor ( x,y coordinates of the former are the same of those of the latter, after subtraction of the window borders and position ). But for the MyGUI cursor the window extent has not changed. If i get the cursor coordinates using MyGUI::InputManager::getInstance().getMousePosition();
and the cursor is placed in the bottom right corner it says 1024,576 and not 1303,694 ( the new window size ): it looks like MyGUI keeps the old coordinate system but stretch it on the new window size.

icaromotta

27-08-2010 15:55:14

I'm having the same problem.

Are you solved this?

icaromotta

27-08-2010 17:41:24

Did Somebody solve this or knows how do it?

icaromotta

27-08-2010 19:20:52

So, I managed to resolve the problem by setting throughout windowResiseEvent () of the renderwindow ogrePlatform.

icaromotta

27-08-2010 19:35:01

I found the problem. The method windowResized() od the MyGui.OgrePlatform is not executing implicit with the application.