Game Development Community

Changing orientation during run-time problem, iTorque 1.5

by Simon Almqvist Pettersson · in iTorque 2D · 06/01/2012 (12:28 am) · 5 replies

If I switch from landscape mode to portrait with the setScreenOrientation() function the rendered area rotates but it does not fill out the entire screen. The left and right edges end up outside of the screen and the top and bottom end up a bit into the screen, leaving an empty area above and below the actual game area.

It's like it rotates correctly but doesn't resize to fill up the new screen dimensions. I have tried changing values here and there, but nothing works. The device I have tested with is an iPad 1.

Does anyone know how to fix this?

#1
06/01/2012 (12:13 pm)
That's odd. I thought we had fixed that bug already. I'll have to test this in the 1.5.1 preview before I release it. Does this happen on both simulator and device? What does it do on other devices, if you have tested them? Any changes to the source code?
#2
06/03/2012 (12:44 am)
I am out of town during the weekend, but I will get more details on monday. The retina fix for iPad 3 is added to the source. If I start in portrait mode it looks correctly, but I have not tested to rotate it to landscape during run-time when the starting mode is protrait. I will have to test it on monday as well.
#3
06/03/2012 (11:55 am)
Are you testing on an iPad1 or iPad3? Rotation doesn't work properly on the retina iPad3 at the moment.
#4
06/04/2012 (12:33 am)
I have now tested some more. On iPad 1 and non-retina iphones the rotation is like I described above. Part of the game area ends up outside of the sides of the screen and the top and bottom does not go all the way out to the top and bottom of the screen, leaving a bit of space that contains nothing above and below the gaming area.

I have now tested with checking the boxes "enable rotation" and "allow rotate to portrait" in the editor. But I have also tested to use script and calling
setScreenOrientation(true, false);
The strange thing is that these ways to change orientation does not yield exactly the same results. If I use the checkboxes in the editor and trigger the orientation change by rotating the actual device the retina devices works the same as the non-retina ones (the rotation works but the gaming area is not resized to fit the new screen dimensions). The top and bottom area of the screen that end up outside the actual gaming area after the orientation change is white when the script function is used, but is black when the rotation of the device triggered the orientation change.

If I trigger an orientation change by script setScreenOrientation() the retina devices show only a black screen with a white stripe on one side. The non-retina devices works the same as described above.

The only source code change that I have added that might affect this is the retina fix for the ipad 3.
#5
06/04/2012 (4:14 am)
Well setScreenOrientation() is broken for sure on retina iPads. I reported it during the testing on 1.5.1. I don't have an older iPad to test on but its possible it doesn't work there either.

However, regular "automatic" rotation should be working, or at least was for me last I tried it.

You should do the exact same test against an unmodified engine and see what happens.