Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix for wrong auto rotation on iOS #2250

Merged
merged 1 commit into from

6 participants

@mrhelmut

iOS has inverted LanscapeLeft and LandscapeRight orientation compared to XNA.
While other methods take that in account, it was missing in ToUIInterfaceOrientationMask, which was a potential source of unwanted auto rotation (overriding SupportedOrientations) and crashes if the rotation resulted in unsupported Info.plist orientations.

See codeplex discussion for details: https://monogame.codeplex.com/discussions/535677

@mrhelmut mrhelmut Fix for wrong auto rotation on iOS
iOS has inverted LanscapeLeft and LandscapeRight orientation compared to XNA.
While other methods take that in account, it was missing in ToUIInterfaceOrientationMask, which was a potential source of unwanted auto rotation and crashes if the rotation resulted in unsupported Info.plist orientations.

See codeplex discussion for details: https://monogame.codeplex.com/discussions/535677
9b6efa3
@mgbot
Collaborator

Can one of the admins verify this patch?

@mgbot
Collaborator

Can one of the admins verify this patch?

@tomspilman
Owner

@mgbot test

@mgbot
Collaborator

Test PASSed.
Refer to this link for build results: http://build.monogame.net/job/PullRequestTester/594/

@totallyeviljake

@nezz was the original author of the orientation changes on ios way back last year. We've released updated games since then that were set to landscape left, but no autorotation. Adam, can you verify this change? I think John Peppers was also on that conversation ...

@tomspilman
Owner

I asked @RayBatts about this and he felt it made sense. He did a similar fix in another area before.

@Nezz

We've never made a difference between landscape left and right, but we have used game center and it popped up the right way. I will have a look at this over the weekend.

@Nezz

I have vertified this fix. It only affects edge cases like the one that was described as everywhere else landscape left and right are swapped correctly. The PR can be merged.

@Nezz

@tomspilman Can you please merge this? :)

@KonajuGames KonajuGames merged commit 713019e into mono:develop

1 check passed

Details default Merged build finished.
@KonajuGames
Owner

Done.

@Nezz

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 27, 2014
  1. @mrhelmut

    Fix for wrong auto rotation on iOS

    mrhelmut authored
    iOS has inverted LanscapeLeft and LandscapeRight orientation compared to XNA.
    While other methods take that in account, it was missing in ToUIInterfaceOrientationMask, which was a potential source of unwanted auto rotation and crashes if the rotation resulted in unsupported Info.plist orientations.
    
    See codeplex discussion for details: https://monogame.codeplex.com/discussions/535677
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 2 deletions.
  1. +4 −2 MonoGame.Framework/iOS/OrientationConverter.cs
View
6 MonoGame.Framework/iOS/OrientationConverter.cs
@@ -113,9 +113,11 @@ public static UIInterfaceOrientationMask ToUIInterfaceOrientationMask (DisplayOr
case((DisplayOrientation)0):
case((DisplayOrientation)3):
return UIInterfaceOrientationMask.Landscape;
- case((DisplayOrientation)1):
- return UIInterfaceOrientationMask.LandscapeLeft;
+ // NOTE: in XNA, Orientation Left is a 90 degree rotation counterclockwise, while on iOS
+ // it is a 90 degree rotation CLOCKWISE. They are BACKWARDS!
case((DisplayOrientation)2):
+ return UIInterfaceOrientationMask.LandscapeLeft;
+ case((DisplayOrientation)1):
return UIInterfaceOrientationMask.LandscapeRight;
case((DisplayOrientation)4):
return UIInterfaceOrientationMask.Portrait;
Something went wrong with that request. Please try again.