【问题标题】:XNA: get screen's width and heightXNA:获取屏幕的宽度和高度
【发布时间】:2010-11-25 12:56:20
【问题描述】:

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

【问题讨论】:

    标签: xna fullscreen


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

      GraphicsDevice.Viewport.Width
      GraphicsDevice.Viewport.Height
      

      当我发现运行窗口模式时

      GraphicsDevice.DisplayMode.Width
      GraphicsDevice.DisplayMode.Height 
      

      给我整个屏幕的分辨率。

      希望这对其他人有所帮助。

      【讨论】:

      • 这实际上是我所要求的;窗口宽度/高度是另一回事。
      【解决方案3】:

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

      GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height
      GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-09-25
        • 2011-06-12
        • 2012-11-01
        • 2021-02-07
        • 1970-01-01
        • 2011-08-06
        相关资源
        最近更新 更多