【发布时间】:2014-02-11 01:36:26
【问题描述】:
所以在我的 2d 塔防游戏中,我需要获取屏幕分辨率以用于我的缩放矩阵。但是我找不到可行的方法。我试过了:
_graphics.GraphicsDevice.Viewport.Width
和
GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width
//It always crashes the game
_graphics.PreferredBackBufferWidth
//Also crashes
这是我的确切代码
screenscalex = (float) *whatever i put here* / 1366f;
谢谢!
【问题讨论】:
-
"但是我找不到可行的方法。" 您尝试过哪些方法? XNA: get screen's width and height?
-
你试过
graphics.PresentationParameters.PreferredBackBufferWidth吗? (和高度) -
这里放上我试过的代码
-
“崩溃”是什么意思?
-
回到开始画面,游戏停止调试