Skip to content

Commit

Permalink
Trying again
Browse files Browse the repository at this point in the history
  • Loading branch information
Nezz committed Feb 12, 2013
1 parent 14bc6c9 commit ca1e660
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions MonoGame.Framework/Android/AndroidGameWindow.cs
Expand Up @@ -269,7 +269,7 @@ internal DisplayOrientation GetEffectiveSupportedOrientations()
}
else
{
return DisplayOrientation.Portrait | DisplayOrientation.PortraitUpsideDown;
return DisplayOrientation.Portrait | DisplayOrientation.PortraitDown;
}
}
else
Expand All @@ -294,8 +294,8 @@ internal void SetOrientation(DisplayOrientation newOrientation, bool applyGraphi
newOrientation = DisplayOrientation.LandscapeRight;
else if ((supported & DisplayOrientation.Portrait) != 0)
newOrientation = DisplayOrientation.Portrait;
else if ((supported & DisplayOrientation.PortraitUpsideDown) != 0)
newOrientation = DisplayOrientation.PortraitUpsideDown;
else if ((supported & DisplayOrientation.PortraitDown) != 0)
newOrientation = DisplayOrientation.PortraitDown;
}

DisplayOrientation oldOrientation = CurrentOrientation;
Expand Down Expand Up @@ -386,7 +386,7 @@ private set
{
DisplayOrientation supported = GetEffectiveSupportedOrientations();
ScreenOrientation requestedOrientation = ScreenOrientation.Unspecified;
bool wasPortrait = _currentOrientation == DisplayOrientation.Portrait || _currentOrientation == DisplayOrientation.PortraitUpsideDown;
bool wasPortrait = _currentOrientation == DisplayOrientation.Portrait || _currentOrientation == DisplayOrientation.PortraitDown;
bool requestPortrait = false;

bool didOrientationChange = false;
Expand All @@ -413,7 +413,7 @@ private set
requestedOrientation = (ScreenOrientation)ScreenOrientationAll.Portrait;
requestPortrait = true;
break;
case DisplayOrientation.PortraitUpsideDown:
case DisplayOrientation.PortraitDown:
requestedOrientation = (ScreenOrientation)ScreenOrientationAll.ReversePortrait;
requestPortrait = true;
break;
Expand All @@ -432,8 +432,8 @@ private set
requestPortrait = false;
}
// Check if the requested orientation is either of the portrain orientations and any portrait orientation is supported.
else if ((value == DisplayOrientation.Portrait || value == DisplayOrientation.PortraitUpsideDown) &&
((supported & (DisplayOrientation.Portrait | DisplayOrientation.PortraitUpsideDown)) != 0))
else if ((value == DisplayOrientation.Portrait || value == DisplayOrientation.PortraitDown) &&
((supported & (DisplayOrientation.Portrait | DisplayOrientation.PortraitDown)) != 0))
{
didOrientationChange = true;
_currentOrientation = DisplayOrientation.Portrait;
Expand Down
2 changes: 1 addition & 1 deletion MonoGame.Framework/Android/OrientationListener.cs
Expand Up @@ -55,7 +55,7 @@ public override void OnOrientationChanged(int orientation)
break;
case 0: disporientation = DisplayOrientation.Portrait;
break;
case 180: disporientation = DisplayOrientation.PortraitUpsideDown;
case 180: disporientation = DisplayOrientation.PortraitDown;
break;
default:
disporientation = DisplayOrientation.LandscapeLeft;
Expand Down
4 changes: 2 additions & 2 deletions MonoGame.Framework/MacOS/GameWindow.cs
Expand Up @@ -284,7 +284,7 @@ private void FillTouchCollection(NSSet touches)
break;
}
case DisplayOrientation.PortraitUpsideDown :
case DisplayOrientation.PortraitDown :
{
translatedPosition = new Vector2( ClientBounds.Width - position.X, ClientBounds.Height - position.Y );
break;
Expand Down Expand Up @@ -316,7 +316,7 @@ private void FillTouchCollection(NSSet touches)
break;
}
case DisplayOrientation.PortraitUpsideDown :
case DisplayOrientation.PortraitDown :
{
translatedPosition = new Vector2( ClientBounds.Width - position.X, ClientBounds.Height - position.Y );
break;
Expand Down
22 changes: 11 additions & 11 deletions MonoGame.Framework/iOS/OrientationConverter.cs
Expand Up @@ -77,15 +77,15 @@ public static DisplayOrientation UIDeviceOrientationToDisplayOrientation(UIDevic
{
switch (orientation)
{
case UIDeviceOrientation.FaceDown: return DisplayOrientation.FaceDown;
case UIDeviceOrientation.FaceUp: return DisplayOrientation.FaceUp;
case UIDeviceOrientation.FaceDown: return DisplayOrientation.Unknown;
case UIDeviceOrientation.FaceUp: return DisplayOrientation.Unknown;
default:
// 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 UIDeviceOrientation.LandscapeLeft: return DisplayOrientation.LandscapeRight;
case UIDeviceOrientation.LandscapeRight: return DisplayOrientation.LandscapeLeft;
case UIDeviceOrientation.Portrait: return DisplayOrientation.Portrait;
case UIDeviceOrientation.PortraitUpsideDown: return DisplayOrientation.PortraitUpsideDown;
case UIDeviceOrientation.PortraitUpsideDown: return DisplayOrientation.PortraitDown;
}
}

Expand All @@ -99,26 +99,26 @@ public static DisplayOrientation ToDisplayOrientation(UIInterfaceOrientation ori
case UIInterfaceOrientation.LandscapeLeft: return DisplayOrientation.LandscapeRight;
case UIInterfaceOrientation.LandscapeRight: return DisplayOrientation.LandscapeLeft;
case UIInterfaceOrientation.Portrait: return DisplayOrientation.Portrait;
case UIInterfaceOrientation.PortraitUpsideDown: return DisplayOrientation.PortraitUpsideDown;
case UIInterfaceOrientation.PortraitUpsideDown: return DisplayOrientation.PortraitDown;
}
}

public static UIInterfaceOrientationMask ToUIInterfaceOrientationMask (DisplayOrientation orientation)
{
switch (Normalize(orientation))
{
case((DisplayOrientation)1):
case((DisplayOrientation)6):
case((DisplayOrientation)0):
case((DisplayOrientation)3):
return UIInterfaceOrientationMask.Landscape;
case((DisplayOrientation)2):
case((DisplayOrientation)1):
return UIInterfaceOrientationMask.LandscapeLeft;
case((DisplayOrientation)4):
case((DisplayOrientation)2):
return UIInterfaceOrientationMask.LandscapeRight;
case((DisplayOrientation)16):
case((DisplayOrientation)4):
return UIInterfaceOrientationMask.Portrait;
case((DisplayOrientation)32):
case((DisplayOrientation)8):
return UIInterfaceOrientationMask.PortraitUpsideDown;
case((DisplayOrientation)14):
case((DisplayOrientation)7):
return UIInterfaceOrientationMask.AllButUpsideDown;
default:
return UIInterfaceOrientationMask.All;
Expand Down

0 comments on commit ca1e660

Please sign in to comment.