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.
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.
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.
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.
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).
This sounds like important stuff. Thanks for taking the time to post it. Maybe it would help the developers if you could provide the specifics of which platform did what. Maybe in a Google spreadsheet?
I do have a spreadsheet. What I originally wrote was too long and dry and included all the details. Yes, longer and drier than this one. The complication of the spreadsheet is that you can’t upload it directly to the forum.
Here is a google sheet for it. It lost the formatting when uploading, so I had to manually redo it. Hopefully I didn’t get it wrong. Bolded items are where the numbers changed. The “After Setting In Constructor” is where I changed to using the CurrentDisplayMode values for the PreferredBackBuffer size and set full screen mode. That is the only place where I changed any of the values.
GDM = GraphicsDeviceManager
DM = GraphicsDevice.DisplayMode
PPBB = GraphicsDevice.PresentationParameters.BackBuffer
VP = GraphicsDevice.Viewport
CDM = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode
PBB = PreferredBackBuffer
CB = Window.ClientBounds