[iOS] How does MyGUI know about RenderWindow resizing?

simed

22-10-2013 12:47:23

I have same code running on win32 and iOS. In win32, if I resize the window my GUI components sit at the same position or move properly depending if they are absolutely or relatively positioned.

On iOS when I rotate the device, this doesn't happen. It looks like MyGUI is still rendering to a 1024x768 window, which has been stretched to 768x1024 (landscape VS portrait mode on iPad 2).

I wonder how MyGUI knows about the render-window dimensions to resize things properly, so that I can try to reuse/call this logic on iOS. I'm not asking for advice on iOS - though if anyone knows, please share - just how MyGUI works.

Thanks.

Altren

22-10-2013 19:41:21

This is done from platform code. MyGUI.OgrePlatform in your case.
MyGUI::OgreRenderManager listens for
virtual void windowResized(Ogre::RenderWindow* _window)that comes from one of those
public Ogre::WindowEventListener,
public Ogre::RenderQueueListener,
public Ogre::RenderSystem::Listener

Check OgreRenderManager::windowResized method and other places where OGRE_NO_VIEWPORT_ORIENTATIONMODE used. There is some logic related to device orientation. May be it was broken or changed after some version updates.

simed

22-10-2013 20:20:43

Thanks, this makes sense - it seems Ogre::WindowEventListener doesn't get used on Ogre iOS.

Should I be trying to call OgreRenderManager::windowResized() myself, if I write some code to detect orientation change, to 'trick' MyGUI into updating?

Altren

26-10-2013 00:49:14

Yes, changing Ogre.Platform or manually calling windowResized would do the trick.
May be that code that is already in MyGUI works only for Ogre on Android, but I remember that it worked before.

simed

26-10-2013 11:05:11

In linked thread in main forum: http://www.ogre3d.org/forums/viewtopic.php?f=21&t=79181

Definitely no windowResized event happens on iOS, so if MyGUI relies on this it won't work :) A viewport listener should be notified, but MyGUI doesn't use that... I don't know about the other event handlers types you mentioned.

If I get a workaround which doesn't require any MyGUI changes, I'll post it here.