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

What is the proper way to get draw area size and screen resolution?

$
0
0

@kennethsuda wrote:

Prompted by another post, I did some testing on most of the platforms I have access to and found that the various screen and window resolution metrics are not consistent between them. I looked at GraphicsDevice.DisplayMode., GraphicsDevice.PresentationParameters.BackBuffer, GraphicsDevice.Viewport., GraphicsAdapter.DefaultAdapter.CurrentDisplayMode., graphics.PreferredBackBuffer*, and Window.ClientBounds.*. I tested with mostly the current dev version using source except for MacOS where I can't get it to run so I used 3.5.1 sable.

1) Which variable should represent the window size such that I can use it to set the PreferredBackBuffer size when setting full screen? CurrentDisplayMode looks to be the most correct/logical, but is wrong on several platforms.

2) Should the full screen and PreferredBackBuffer size be set in the Game1 constructor or Game1.Initialize (before or after base.Initialize)? Some of the platforms did not have the correct size in any of the variables until the first Update call.

3) When not running as full screen, which variable should represent the draw area size and at what point should it be correct? CLientBounds was sometimes not correct until the first Update call.

4) Are there cases where a platform will change the PreferredBackBuffer size after you set it? There are several platforms where it changed after Initialize and before the first Update.

When testing full screen, I set the full screen flag in the Game1 constructor after the GraphicsDeviceManager create and set the PreferredBackBuffer size to be the CurrentDisplayMode size. I did the size setting, even when the CurrentDisplayMode size was wrong (0x0).

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles