How to set iPhone to landscape mode with SDL 1.3?

Is there documentation for the iPhone-specific parts of SDL 1.3 somewhere? If not, maybe someone can answer this simple question: do I use SDL to set the iPhone to landscape mode? (It currently runs in “tall” orientation.)

I tried using 960x640 instead of 640x960, but that doesn’t set the orientation. It just makes the display take up the wrong area while in “tall” orientation.

Do I need to access iPhone APIs directly to flip to landscape mode, or is it possible to do this from within SDL 1.3?

Call…

SDL_SetHint( “SDL_IOS_ORIENTATIONS”, “LandscapeLeft LandscapeRight” );

…before you create your window.On Wed, 18 Jan 2012 14:44:57 -0800 VernJensen wrote:

Is there documentation for the iPhone-specific parts of SDL 1.3
somewhere? If not, maybe someone can answer this simple question: do
I use SDL to set the iPhone to landscape mode? (It currently runs in
"tall" orientation.)

I tried using 960x640 instead of 640x960, but that doesn’t set the
orientation. It just makes the display take up the wrong area while
in “tall” orientation.

Do I need to access iPhone APIs directly to flip to landscape mode,
or is it possible to do this from within SDL 1.3?

Awesome, thanks!

For anyone else wondering where in the 1.3 Documentation Wiki this is mentioned, I found this:

http://wiki.libsdl.org/moin.cgi/CategoryHints

The hint mentioned is a backdoor method that certainly works. SDL is
supposed to report both landscape and portrait modes and choose the
orientation that best matches your aspect ratio. This works on the iPad,
but is part of what doesn’t work on the retina display.On Wed, Jan 18, 2012 at 5:44 PM, VernJensen wrote:

**
Is there documentation for the iPhone-specific parts of SDL 1.3 somewhere?
If not, maybe someone can answer this simple question: do I use SDL to set
the iPhone to landscape mode? (It currently runs in “tall” orientation.)

I tried using 960x640 instead of 640x960, but that doesn’t set the
orientation. It just makes the display take up the wrong area while in
"tall" orientation.

Do I need to access iPhone APIs directly to flip to landscape mode, or is
it possible to do this from within SDL 1.3?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

You will need at least the hint or the SDL_WINDOW_RESIZABLE flag in
order to enable landscape, regardless of which modes are reported or
selected. These elements are responsible for selecting was
shouldAutorotateToInterfaceOrientation returns.

If it was up to me I would remove the SDL_WINDOW_RESIZABLE for iOS
altogether as its semantics don’t really read as "enable all rotations"
to me.On 19/01/2012 01:32, Sam Lantinga wrote:

The hint mentioned is a backdoor method that certainly works.

Tim Angus wrote:> On Wed, 18 Jan 2012 14:44:57 -0800 VernJensen wrote:

Call…

SDL_SetHint( “SDL_IOS_ORIENTATIONS”, “LandscapeLeft LandscapeRight” );

…before you create your window.

Somehow this didn’t worked for me. I tried to use RESIZABLE flag with it but stil nothing. What can be the issue? What are other conditions?

StDogbert wrote:

Tim Angus wrote:

Call…

SDL_SetHint( “SDL_IOS_ORIENTATIONS”, “LandscapeLeft LandscapeRight” );

…before you create your window.

Somehow this didn’t worked for me. I tried to use RESIZABLE flag with it but stil nothing. What can be the issue? What are other conditions?

Try using BOTH. Worked for me.> > On Wed, 18 Jan 2012 14:44:57 -0800 VernJensen wrote:

You need to enumerate the available modes using
SDL_GetNumDisplayModes/SDL_GetDisplayMode, then choose a widescreen one
using SDL_SetWindowDisplayMode/SDL_SetWindowFullscreen. Turns out I was
wrong about needing to set the hint or RESIZABLE flag. This certainly
used to be the case before various fixes went in (around November), but
shouldn’t be necessary any more unless you have very specific needs.

For things to work properly on the iPhone 4, you’ll also want to apply
the patch from bug #1394.On 26/01/2012 08:50, StDogbert wrote:

Somehow this didn’t worked for me. I tried to use RESIZABLE flag with it
but stil nothing. What can be the issue? What are other conditions?

Thank You for your answer.
I’ve enumerated modes and got one I need ( widescreen). Then I invoked SDL_SetWindowDisplayMode() and SDL_SetWindowFullscreen().
However it did not changed anything. The app still runs in vertical mode.
I’ve tried setting resizable flag, and app started to rotate, but it’s screen was twice smaller then real phone screen size (btw I’m using iPhone 4 ).
Also I’ve tried invoking SetHint before window creation, but it didn’t helped either.
Maybe there are other functions that can modify display options on iPhone?