如何在XNA中获得整个屏幕的宽度和高度?
答案 0 :(得分:78)
根据经验,我发现在XNA 4.0中我需要使用
GraphicsDevice.Viewport.Width
GraphicsDevice.Viewport.Height
运行窗口模式时,我发现
GraphicsDevice.DisplayMode.Width
GraphicsDevice.DisplayMode.Height
给了我整个屏幕的分辨率。
希望这有助于其他人。
答案 1 :(得分:59)
这似乎是它(我自己用google搜索“xna屏幕宽度高度”):
GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height
GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width
答案 2 :(得分:2)
GraphicsDevice.Viewport.Bounds - 返回Rectangle2D,它有参数Width和Height。