Screen Coordinate System in Landscape Mode (Android)

Hi Everyone. This is my 1st post on this forum.

I am creating a card game for Android/Windows - focusing on the Android version now.

And I am having some (basic) doubts regarding the screen coordinate system when the Android phone is rotated (i.e.: in Landscape mode).

I ran a couple of tests:

1- Phone in Portrait mode:

I render a small Card Sprite on screen pos (0,0) and I get:


Which is expected .

Now, when I just rotate the phone (or emulator in my case), the image is still at (0,0):

But, things I have noticed (and need some feedback here, if possible):

A- My assets don’t automatically rotate when the screen rotates (I think this is the expected behavior?).
B- With the screen in Landscape mode, when I use the following to draw:

spriteBatch.Draw(text1, new Rectangle(0, 0, 100, 100), Color.White);

I notice the x,y params are inverted… With landscape mode, if I want my sprite a bit to the right I need to increment the Y coordinate instead of the X one… Sure the phone is rotated, but my expectation was that the framework would handle that?

My question then is:

If I write a game in Landscape mode, do I need to invert all the coordinates? X becomes Y and vice-versa?

Any input is really appreciated.


What about forcing the game to draw in the preffered mode: lanscape or portrait(?) . I think that this is possible using the default Android APIs(?).

1 Like

Wow, thanks for the super quick reply.

What I have tried:

graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft;

But it does not change anything…

1 Like

To illustrate my issue a bit further:


Problem solved after some online search… Happens that this is handled by Android like @Athanatos mentioned.

The solution is to change the Activity settings/params right in the Activity1.cs file like so:

[Activity(Label = “Android”
, MainLauncher = true
, Icon = “drawable/icon”
, Theme = “style/Theme.Splash”
, AlwaysRetainTaskState = true
, LaunchMode = Android.Content.PM.LaunchMode.SingleInstance
, ScreenOrientation = ScreenOrientation.Landscape
, ConfigurationChanges = ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize | ConfigChanges.ScreenLayout)]

That solves it and coordinate system / screen are working as expected now.

Hope this helps someone else. :slight_smile:

1 Like