Bennu Game Development

English Forums => Helpdesk => Topic started by: xDan on August 21, 2011, 12:37:22 PM

Title: Screen rotation on an iPad
Post by: xDan on August 21, 2011, 12:37:22 PM
Hello,

So I'm trying to port an old game that was made for 1024x768 resolution to iPad, using the iOS bennu port. This should work nicely since the iPad is 768x1024...

But is there some way to cause the screen to be rotated 1024x768 -> 768x1024 behind the scenes? Or do I have to rewrite everything with graphics rotated and coordinates flipped to run in the different screen mode?

I've been experimenting with scale_resolution_orientation = 1, but maybe that's not what I'm looking for since it doesn't seem to have an affect...
Title: Re: Screen rotation on an iPad
Post by: josebita on August 21, 2011, 03:57:02 PM
You have to use scale_resolution_orientation, yes. But for it to work you also have to set scale_resolution to the same resolution you've set with set_mode.
I'm trying to improve the code to make rotation easier but it's not yet working. I'll let you know when it is.
Title: Re: Screen rotation on an iPad
Post by: xDan on August 21, 2011, 07:12:28 PM
Thanks, that works :)

Though it took me quite a while to realise that the scale_resolution stuff had to be *before* the call to set_mode, I'm not sure that's noted anywhere...

For future reference:

[code language="bennu"]   scale_resolution_orientation = 3;
   scale_resolution = 09600640;
   set_mode(1024,768,16,MODE_FULLSCREEN);[/code]

I'm using 960x640 there as it seems to be the resolution of the iPad simulator... (using a greater resolution than available also causes a crash...)
Title: Re: Screen rotation on an iPad
Post by: xDan on August 21, 2011, 11:05:15 PM
just another quick question for anyone that knows about iOS stuff... :)

Currently, when switching (in the simulator) between the portrait and portrait-upside-down orientations, it autorotates, but when switching between landscape modes, it doesn't autorotate.

This is the correct behaviour for a portrait mode game, but not one in landscape... it gets quite confusing, with the screen turning when it doesn't need to and ending up upside down in landscape mode.

Is there any way to either disable autorotate or to make it work correctly for landscape mode?

Maybe this is an Xcode problem or specific to my project... but I tried setting the supported orientations in the Xcode project and it doesn't seem to have an affect.

sorry, I'm totally new to all this iOS stuff :S
Title: Re: Screen rotation on an iPad
Post by: josebita on August 21, 2011, 11:43:18 PM
This is a known bug. In theory you should be able to change the behaviour in your project's xcode settings (I believe it's called supported interface orientations or something like that).
The problem is there becausewhen BennuGD rotates the screen it doesn't tell iOS about it. It should work correctly when the new code lands.
Title: Re: Screen rotation on an iPad
Post by: xDan on August 22, 2011, 09:31:16 AM
Ok I see, thanks  :)
Title: Re: Screen rotation on an iPad
Post by: xDan on August 23, 2011, 11:00:10 PM
ahh, and I must ask:

any ETA on when the new code might land? ;D
Title: Re: Screen rotation on an iPad
Post by: josebita on August 24, 2011, 07:57:07 AM
Quote from: xDan on August 23, 2011, 11:00:10 PM
ahh, and I must ask:

any ETA on when the new code might land? ;D
No, sorry. I'm pretty busy in real life lately but I'll try to push this new changes ASAP.