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 - Patch that enables configuration of allowable screen orientations on iOS
Summary: Patch that enables configuration of allowable screen orientations on iOS
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: ARM iOS (All)
: P2 enhancement
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-03 14:24 UTC by Tim Angus
Modified: 2011-06-13 10:24 UTC (History)
1 user (show)

See Also:


Attachments
Patch that enables configuration of allowable screen orientations on iOS (1.90 KB, patch)
2011-06-03 14:24 UTC, Tim Angus
Details | Diff
Patch that enables configuration of allowable screen orientations on iOS (2.88 KB, patch)
2011-06-10 06:27 UTC, Tim Angus
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.