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 4276 - No way to detect orientation flip on iOS
Summary: No way to detect orientation flip on iOS
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: don't know
Hardware: iPhone/iPod touch iOS 9
: P2 API change
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-27 13:04 UTC by Ryan David Sheasby
Modified: 2018-09-27 21:51 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan David Sheasby 2018-09-27 13:04:21 UTC
Hi team. I've run into a problem with Love2d(based on SDL obviously) on iOS. When you do an orientation flip(not a rotation from portrait to landscape, a flip from portrait to upside-down portrait or something like that), there is no event triggered from SDL. The only orientation-based event is SDL_WINDOWEVENT_RESIZED which is only triggered when changing dimensions i.e. portrait <-> landscape. This is a crucial missing functionality. This is especially problematic due to the fact that accelerometer data is constant meaning it does not get inverted when you flip the device. Hence an accelerometer-based driving game for example would have to be locked to a single orientation as wheen you flip the device the steering would be inverted.
Comment 1 Sam Lantinga 2018-09-27 21:51:36 UTC
In SDL 2.0.9 you use the function SDL_GetDisplayOrientation(), and watch for the event SDL_DISPLAYEVENT to detect changes.

You can get a prerelease version here:
http://www.libsdl.org/tmp/SDL-2.0.zip

Cheers!