48

如何在 XNA 中获取整个屏幕的宽度和高度?

4

3 回答 3

80

根据经验,我发现在 XNA 4.0 中我需要使用

GraphicsDevice.Viewport.Width
GraphicsDevice.Viewport.Height

运行窗口模式时,我发现

GraphicsDevice.DisplayMode.Width
GraphicsDevice.DisplayMode.Height 

给我整个屏幕的分辨率。

希望这可以帮助其他人。

于 2010-11-10T21:17:44.057 回答
61

这似乎是它(我自己只是用谷歌搜索“xna 屏幕宽度高度”):

GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height
GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width
于 2009-09-04T06:46:10.247 回答
3

GraphicsDevice.Viewport.Bounds - 这将返回 Rectangle2D 并具有参数 Width 和 Height。

于 2018-03-27T07:18:19.443 回答