9

我正在使用 Monogame 和 C# 开发游戏。我有一个全屏启动的菜单的 wpf 应用程序。当我点击菜单上的播放时,我进入 Monogame 项目。如何像使用 wpf 菜单一样全屏启动 Monogame 解决方案?

4

3 回答 3

9

您可以将IsFullscreen属性设置为true

//you likely already have this line (or similar)
graphics = new GraphicsDeviceManager(this);

//set the GraphicsDeviceManager's fullscreen property
graphics.IsFullScreen = true;
于 2013-03-08T19:56:04.587 回答
4

这是monogame的正确方法

GraphicsDeviceManager graphics;
graphics = new GraphicsDeviceManager(this);
graphics.ToggleFullScreen();
于 2016-05-24T20:59:46.210 回答
1

有两种方法可以使应用程序全屏显示。一种是通过设置IsFullScreen属性,另一种是通过调用ToggleFullScreen方法。

请记住,根据文档,如果您在初始化期间更改属性,这将自动设置全屏模式。但是在更改属性时,而不是在初始化时,您需要调用该ApplyChanges方法。

// probably already defined
graphics = new GraphicsDeviceManager(this);

// ...

graphics.IsFullScreen = true;

// don't forget to call ApplyChanges, if you are not in the Initialize method
graphics.ApplyChanges();
// probably already defined 
graphics = new GraphicsDeviceManager(this);

// ...

graphics.ToggleFullScreen();
于 2020-05-25T19:21:43.173 回答