Detect Surface Pro orientation in Windows Standalone build

Hi guys !

I’m struggling with my app because I’m trying to find a solution to make PC Standalone build for a Surface Pro. I have specific reasons to do not build a UWP game.

I would like to :

  1. Detect my game is currently running on a Surface Pro. As far as I know, Application.platform and DeviceType won’t help because the latter returns “Desktop” and not “Handheld”. I also tried using SystemInfo.supportsGyroscope or SystemInfo.supportsAccelerometer but it returns false on the device…
  2. Find a solution to force full screen landscape mode on start. Indeed, if I switch from landscape to portrait mode on the Surface, the resolution changes and when I go back to landscape mode the resolution is saved to the portrait one… I found a solution to lock screen autorotation and force landscape with this, it is ok if I start the game in landscape mode, but if I start the game in portrait mode, it still goes wrong with the resolution… and, Screen.orientation returns “Portrait” whether I start in portrait or Landscape mode…

Any ideas…? Thanks

Well, I found a solution to my problem, if someone is interested in :

GetSystemMetrics(SM_TABLETPC) did the job for me, it returns 1 on my Surface Pro and 0 on my PC.
Then I force the landscape mode with SetDisplayAutoRotationPreferences.
As Screen.width, Screen.height or Screen.currentResolution does not return physical screen values in portrait mode, I am forced to get maximum physical height and width by using Screen.resolutions. Finally, I set the screen resolution with Screen.SetResolution with maxima I just got. Be carefull, if you start in portrait mode, the max width to set is the max height and vice-versa !

Let me know if you need more info