We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1214

Summary: Patch that enables configuration of allowable screen orientations on iOS
Product: SDL Reporter: Tim Angus <tim>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2 CC: icculus
Version: HG 2.0   
Hardware: ARM   
OS: iOS (All)   
Attachments: Patch that enables configuration of allowable screen orientations on iOS
Patch that enables configuration of allowable screen orientations on iOS

Description Tim Angus 2011-06-03 14:24:52 UTC
Created attachment 614 [details]
Patch that enables configuration of allowable screen orientations on iOS

For a title I'm developing, the default behaviour of allowing either both portrait orientations or both landscape orientations doesn't really work to the point where it breaks the core game play mechanic. Setting SDL_WINDOW_RESIZABLE and enabling all rotations makes the problem worse. Really what I want to do is restrict which orientations are allowable. Attached is a patch to do this using the hint API. In my particular case I want portrait only:

SDL_SetHint( "SDL_HINT_ORIENTATIONS", "Portrait" );

The second parameter is a space delimited list of the orientations required. If you wanted all orientations then you would call:

SDL_SetHint( "SDL_HINT_ORIENTATIONS", "Portrait PortraitUpsideDown LandscapeLeft LandscapeRight" );

I think this is a fairly important bit of functionality to have, so it would be nice to see it committed at some point.

It may also be worth considering removing the code which treats having SDL_WINDOW_RESIZABLE set as indicating you want all orientations as that functionality is now available with the patch applied. Obviously this would change existing functionality though, so I haven't made this change.
Comment 1 Tim Angus 2011-06-10 06:27:17 UTC
Created attachment 620 [details]
Patch that enables configuration of allowable screen orientations on iOS

I added some documentation to SDL_hints.h, and changed the name of the hint.
Comment 2 Ryan C. Gordon 2011-06-13 10:24:08 UTC
This is now hg revision 4b4258be8699, thanks!

--ryan.