XNA - 获取当前屏幕分辨率

发布于 2024-12-28 09:15:34 字数 97 浏览 5 评论 0原文

是否可以获得当前桌面屏幕分辨率?

我的 XNA 游戏中有一些小设置,其中之一是屏幕分辨率。我想要做的是,如果屏幕分辨率选项大于当前桌面分辨率支持的大小,则将其清空。

Is it possible to get the current desktop screen resolution?

I have a few minor settings in my XNA game one of which is screen resolution. What I want to do is blank out a screen resolution option if it is larger than the current desktop resolution supports.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凉风有信 2025-01-04 09:15:34

GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width.Height 将为您提供设备的当前分辨率。

Game.GraphicsDevice.Viewport 具有您可以查询的高度和宽度变量,这将为您提供视口的分辨率。视口通常是窗口的大小,但这并不能保证。

Window.ClientBounds.Width.Height 将为您提供游戏窗口的分辨率。

GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width and .Height will give you the device's current resolution.

Game.GraphicsDevice.Viewport has height and width variables you can query, that will give you the resolution of your viewport. The viewport is usually the size of the window, but that's not guaranteed.

Window.ClientBounds.Width and .Height will give you the resolution of your game window.

蛮可爱 2025-01-04 09:15:34

GraphicsAdapter.SupportedDisplayModes 将返回所有支持的宽高比的集合。然后,您可以显示该集合中的所有比率。

GraphicsAdapter.SupportedDisplayModes will return a collection of all of the supported aspect ratios. You can then show all of the ratios that are in this collection.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文