更新时间:2023-12-03 15:21:16
我发现您需要设置
GraphicDevice.PreferredBackBufferHeight = height;
GraphicDevice.PreferredBackBufferWidth = width;
当您在游戏类的构造函数中执行此操作时,它会起作用,但是当您尝试在构造函数的外部进行此操作时,还需要调用
When you do this in the constructor of the game class it works, but when you try do to this outside the constructor you also need to call
GraphicsDevice.ApplyChanges();
此外,您可以使用全屏显示(调试时无法正常工作)
Furthermore to have fullscreen (which is not really working correctly while debugging) you can use
if (!GraphicsDevice.IsFullScreen)
GraphicsDevice.ToggleFullScreen();