Incorrect viewport size on Windows 10 Mobile

Hi all,

I’ve just used the MonoGame 3.4 for my game and met a problem with viewport size in Windows Phone 8 project. When I ran on my Lumia 525 (running Windows 10 Mobile, build 10.0.10586.36), the viewport size was 734x480, while the expected value is 800x480. I also checked the PresentationParameters.BackBufferWidth and Window.ClientBounds, they’re the same.

I simply drawn a 800x480 texture on the screen, and it seemed to be stretched outside the screen. Then I tried to set PrefferredBackBuffer size to 800x480 but no help.

Code :

protected override void LoadContent()
{
    background = Content.Load<Texture2D>("background");
}

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.CornflowerBlue);

    spriteBatch.Begin();
    spriteBatch.Draw(background, Vector2.Zero, Color.White);
    spriteBatch.End();

    base.Draw(gameTime);
}

Screenshots :

Windows Phone 8 project

Windows Phone 8.1 project

I read many dicussions about fullscreen issues but no solution.

Hope anyone could help.

Hi,

graphics.GraphicsDevice.Viewport.Width also gave me an incorrect number on Windows 10 Mobile (worked only on Windows 10 Desktop), so I use graphics.GraphicsDevice.DisplayMode.Width, which gives the right value on mobile (gives incorrect value on desktop) :smile:

So I detect the device with Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily and decide which one to use. Maybe not the best solution, but this is how I made it. NEver had yet the chance to try on XBOX One, I assume there we need a 3rd solution. :smile:

@Zoltan_Ferenczfi: Thanks for your help. I tried out the graphics.GraphicsDevice.DisplayMode.Width but it still gave me the incorrect value. Maybe I should get the actual size directly from PhoneApplicationPage.