Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

About change orientation on Android

$
0
0

@nori wrote:

Hello,
I installed MonoGame 3.6.
The orientation do not change automatically when I change the orientation of my smartphone.
So, I wrote some code in OnOrientationChanged().
In MonoGame 3.5, orientation changed automatically and OnClientSizeChanged was called without writing this code.
Is the specification change? or is my setting something wrong?

My added code is...

void OnOrientationChanged(object sender, EventArgs e)
{
  Microsoft.Xna.Framework.AndroidGameWindow g = (Microsoft.Xna.Framework.AndroidGameWindow)sender;
  if(g.CurrentOrientation == DisplayOrientation.LandscapeLeft)
  {
    Game1.Activity.RequestedOrientation = Android.Content.PM.ScreenOrientation.Landscape;
  }else if(g.CurrentOrientation == DisplayOrientation.LandscapeRight)
  {
    Game1.Activity.RequestedOrientation = Android.Content.PM.ScreenOrientation.ReverseLandscape;
  }else
  {
    Game1.Activity.RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait;
  }
}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles