XNA: get screen width and height

How to get the width and height of the whole screen in XNA?

+43
xna fullscreen
Sep 04 '09 at 6:22
source share
2 answers

It seems like this (just googled for β€œxna screen width”):

GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width 
+55
Sep 04 '09 at 6:46
source share

Empirically, I found that in XNA 4.0 I need to use

 GraphicsDevice.Viewport.Width GraphicsDevice.Viewport.Height 

when starting windowed mode when i find

 GraphicsDevice.DisplayMode.Width GraphicsDevice.DisplayMode.Height 

gives me the resolution of the whole screen.

Hope this helps someone else.

+72
Nov 10 2018-10-11
source share



All Articles