Skip to content

Commit

Permalink
Merge pull request #5125 from hach-que/hidpi-check
Browse files Browse the repository at this point in the history
Add a null reference check on DisplayMode for #5040
  • Loading branch information
tomspilman committed Aug 21, 2016
2 parents e8fc3cf + a21833a commit 7ca78f8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions MonoGame.Framework/Graphics/GraphicsDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,18 @@ public GraphicsDevice(GraphicsAdapter adapter, GraphicsProfile graphicsProfile,

private void Setup()
{
// Initialize the main viewport
_viewport = new Viewport (0, 0,
#if DEBUG
if (DisplayMode == null)
{
throw new ApplicationException(
"Unable to determine the current display mode. This can indicate that the " +
"game is not configured to be HiDPI aware under Windows 10 or later. See " +
"https://github.com/MonoGame/MonoGame/issues/5040 for more information.");
}
#endif

// Initialize the main viewport
_viewport = new Viewport (0, 0,
DisplayMode.Width, DisplayMode.Height);
_viewport.MaxDepth = 1.0f;

Expand Down

0 comments on commit 7ca78f8

Please sign in to comment.