且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Xna全屏大小问题

更新时间:2023-12-06 14:08:46

不,必须不是一种方式,对不起。并非所有可能的模式都可用。这实际上取决于您的显卡驱动程序和显示器驱动程序。继续进入Win 8后,旧的图形模式不再可用,您现在可以获得最适合您要求的模式。



在DirectX下,您可以枚举所有可用的模式全屏模式。我现在无法查找,但在XNA中应该有一些方法可以做同样的事情。



然后,为什么你需要知道确切的屏幕分辨率无论如何?硬编码的固定值永远不会很好。为什么不从当前使用的模式中获取此类信息?无论你的游戏运行在什么计算机上,它都将是正确的。
No, there must not be a way, sorry. Not every possible mode must be available. That actually is determined by your graphics card drivers and monitor drivers. After moving on to Win 8, the old graphics mode was not available anymore and you now get the closest mode fitting to your requests.

Under DirectX you can enumerate all available fullscreen modes. I can't look it up right now, but there should be some way to do the same in XNA.

Then again, why do you need to know the exact screen resolution anyway? Hardcoded fixed values will never work very well. Why don't you get such information from the currently used mode? Then it will always be correct, no matter what computer your game is running on.