stefannew
stefannew

Reputation: 172

MonoGame - GraphicsAdapter.DefaultAdapter.Current.Width/Height Reports wrong value on MacBook Pro 2015

I'm attempting to get the resolution of a the user's monitor using MonoDevelop/C#.

On most of the machines I've tested this on, it works flawlessly - with exception of this Macbook Pro.

Native resolution is 2880x1800, but DefaultAdapter width reports 1280x1024. I can manually set the graphics device PreferredBufferHeight and PreferredBufferWidth, and it's fine.

Is there a more reliable way to return the resolution of a monitor?

Upvotes: 0

Views: 422

Answers (1)

Pema Malling
Pema Malling

Reputation: 131

You could reference System.Windows.Forms in your project, and use Screen.PrimaryScreen.Bounds to find out the resolution of the user's screen.

If you have not tried using GraphicsDevice.DisplayMode.Width and GraphicsDevice.DisplayMode.Height you should probably try those first.

Yet another way is GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width and GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height.

Upvotes: 1

Related Questions