XNA: get screen's width and height

后端 未结 3 814
逝去的感伤
逝去的感伤 2020-12-29 01:34

how do i get the width and height of the entire screen in XNA?

3条回答
  •  佛祖请我去吃肉
    2020-12-29 01:59

    Empirically I've found that in XNA 4.0 I need to use

    GraphicsDevice.Viewport.Width
    GraphicsDevice.Viewport.Height
    

    when running windowed mode, as I find

    GraphicsDevice.DisplayMode.Width
    GraphicsDevice.DisplayMode.Height 
    

    gives me the resolution of the entire screen.

    Hopefully this helps someone else out.

提交回复
热议问题