Sorry I have been so quiet, but here is a quick post to let you know I am still here…
On the XBLIG-UK Xmas meeting someone was asking how can you detect the current orientation your phone is in, so I thought I would do a very quick post on it.
Simply, in the Window object of the Game class there is a CurrentOrientation property of type
DisplayOrientation and this tells you the current orientation the device is in, the possible orientations are (yes there are more than 2 orientations..)
DisplayOrientation.Default;
DisplayOrientation.LandscapeLeft;
DisplayOrientation.LandscapeRight;
DisplayOrientation.Portrait;
DisplayOrientation.LandscapeLeft;
DisplayOrientation.LandscapeRight;
DisplayOrientation.Portrait;
And just for the record you can fix what orientations your game supports by doing the following in your Game constructor :-
graphics.SupportedOrientations
= DisplayOrientation.LandscapeLeft;
Hope this helps those of you struggling to detect what orientation your device is in or those wishing to fix their orientation.
No comments:
Post a Comment