iPhone: Viewport orientation

DanielSefton

09-03-2010 15:58:01

Hi,

This is basically a feature request to support Ogre's viewport->setOrientationMode(OR_LANDSCAPELEFT/OR_LANDSCAPERIGHT/OR_PORTRAIT) function. As you can see, when the orientation is landscape, MyGUI does not adjust:



Here's a code example which Ogre's overlays use for correcting orientation in _queueOverlaysForRendering():

http://www.google.com/codesearch/p?hl=e ... cd=2&ct=rc

Also, Zeal mentioned the text being block filled. Well, I have the same problem, and that's what it looks like.

It's in the simulator, so it should be easy to reproduce when you get hold of the iPhone SDK.

Cheers.

ZealAddon

10-03-2010 16:59:32

Just noticed this too.. :( luckily my app is designed for portrait mode, but would be nice to see this fixed for future projects.

Altren

10-03-2010 18:09:35

We are working on it.

my.name

11-03-2010 23:54:31

trunk - 2921

DanielSefton

13-03-2010 23:34:57

Thanks but it doesn't work. :( It causes everything to rotate except MyGUI. The code you added is what I've been trying to do without success.

my.name

14-03-2010 11:54:48

for example


#if OGRE_VERSION >= MYGUI_DEFINE_VERSION(1, 7, 0) && OGRE_NO_VIEWPORT_ORIENTATIONMODE == 0
else if (_key == MyGUI::KeyCode::F1)
{
mWindow->getViewport(0)->setOrientationMode(Ogre::OR_DEGREE_0, false);
mPlatform->getRenderManagerPtr()->setRenderWindow(mWindow);
}
else if (_key == MyGUI::KeyCode::F2)
{
mWindow->getViewport(0)->setOrientationMode(Ogre::OR_DEGREE_90, false);
mPlatform->getRenderManagerPtr()->setRenderWindow(mWindow);
}
else if (_key == MyGUI::KeyCode::F3)
{
mWindow->getViewport(0)->setOrientationMode(Ogre::OR_DEGREE_180, false);
mPlatform->getRenderManagerPtr()->setRenderWindow(mWindow);
}
else if (_key == MyGUI::KeyCode::F4)
{
mWindow->getViewport(0)->setOrientationMode(Ogre::OR_DEGREE_270, false);
mPlatform->getRenderManagerPtr()->setRenderWindow(mWindow);
}
#endif

DanielSefton

15-03-2010 00:04:26

Thanks but it doesn't work. :( It causes everything to rotate except MyGUI. The code you added is what I've been trying to do without success.

Altren

15-03-2010 00:10:42

Have you actually tried to use changed MyGUI.OgrePlatform? It rotates fine on windows. Probably you linked your app with unchanged platform.

DanielSefton

15-03-2010 12:02:44

Well, were any extra changes made to MyGUI core?

All that code does is change the viewport orientation, which is what I do in my project anyway as shown in the screenshot, and it doesn't work. MyGUI just isn't changing orientation on the iPhone. The viewport changes orientation, and the overlays and everything else changes, but not MyGUI. :(

Anyway, I'll try updating to trunk, because I'm using 3.0 (I hope CMake for Mac is working now, I know Zeal couldn't get 3.01's CMake to work) - but unless you made other relevant changes, is it worth the hassle?

Also, not forgetting the iPhone doesn't have keys. :P (which is why I didn't update and just tried the code directly)

Cheers.

Altren

15-03-2010 14:09:39

trunk - 2921Oh well, this message means that you need MyGUI from trunk revision 2921 (or newer) to get viewport orientation working. Of course it won't work with MyGUI 3.0 because my.name made changes in trunk, but not in 3.0.

DanielSefton

15-03-2010 15:42:58

trunk - 2921Oh well, this message means that you need MyGUI from trunk revision 2921 (or newer) to get viewport orientation working. Of course it won't work with MyGUI 3.0 because my.name made changes in trunk, but not in 3.0.
Repeating myself again... (sigh)

All that code does is change the viewport orientation, which is what I do in my project anyway as shown in the screenshot, and it doesn't work. MyGUI just isn't changing orientation on the iPhone. The viewport changes orientation, and the overlays and everything else changes, but not MyGUI. :(

Anyway, I'll try updating to trunk, because I'm using 3.0 (I hope CMake for Mac is working now, I know Zeal couldn't get 3.01's CMake to work) - but unless you made other relevant changes, is it worth the hassle?

Also, not forgetting the iPhone doesn't have keys. :P (which is why I didn't update and just tried the code directly)


This code is all that was added:

http://my-gui.svn.sf.net/viewvc/my-gui/ ... threv=2921

...and it doesn't work, like I said above. That code changes the orientation of the viewport, but on the iPhone, MyGUI doesn't change orientation and everything else does. Exactly what I said in my first post... Because the code that my.name added is what I tried, and it doesn't work.

Understand now? :P

Altren

15-03-2010 17:21:40

Usually changes comes with several commits. Looks at previous commits, for example this two.
http://redmine.mygui.info/repositories/ ... p?rev=2918
http://redmine.mygui.info/repositories/ ... p?rev=2920

DanielSefton

15-03-2010 17:22:46

Ahhh, that's what I wanted to hear. Thanks! :D

DanielSefton

16-03-2010 21:07:13

Okay, updated to trunk and the rotating is working. :)

But there's a problem - the input doesn't rotate. So I have to press in the location that the input would be in portrait mode, if that makes any sense.



Not sure what happened with the widget alignment either, I'm guessing you changed the alignment in trunk?

Also, can you check if this layout code is correct for trunk? I can't get StaticImage to show:

<Widget type="Widget" skin="Default" position_real="0 0 1 1" align="Stretch" layer="Back" name="_Main">
<Widget type="StaticImage" skin="StaticImage" position_real="0 0 1 1" align="Stretch" layer="Back">
<Property key="Image_Texture" value="menubg.jpg"/>
<Property key="Widget_Visible" value="true"/>
</Widget>
etc.


Cheers.

Altren

16-03-2010 22:35:01

Oh, we forgot about input. We'll fix it.
About Align - only Center align behaviour was slightly changed, but not other aligns. Your layout looks ok and we are always trying to keep everything backward compatible, so even old aligns should work in same way as they was working with older versions.

Also, about white rectangles inside fonts: please try to replace line
bool rgbaMode = ! MyGUI::RenderManager::getInstance().isFormatSupported(PixelFormat::L8A8, TextureUsage::Static | TextureUsage::Write);
in MyGUI_ResourceTrueTypeFont.cpp (line 196) withbool rgbaMode = true; and check if that makes fonts render properly.

DanielSefton

16-03-2010 23:41:14

Oh, we forgot about input. We'll fix it.
:)

check if that makes fonts render properly.
It didn't work. :(

my.name

17-03-2010 09:25:42

Run FontViewer

DanielSefton

19-03-2010 14:34:30

Okay, this is really strange. The text is now fine. I added a text widget, and suddenly everything started working -- I then removed the text widget and it was still working. Very odd... :shock: I didn't remove that change you suggested Altren, so maybe that had something to do with it... Perhaps it took a while to 'warm up'... :roll:

So the only problem now is the input. :P