XNA - 获取当前屏幕分辨率
是否可以获得当前桌面屏幕分辨率?
我的 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
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.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.