我正在使用Monogame和C#开发游戏。我有一个wpf应用程序,用于全屏启动的菜单。当我点击菜单上的播放时,我会进入Monogame项目。如何像使用wpf菜单一样全屏启动Monogame解决方案?
答案 0 :(得分:8)
您可以将IsFullscreen
属性设置为true
。
//you likely already have this line (or similar)
graphics = new GraphicsDeviceManager(this);
//set the GraphicsDeviceManager's fullscreen property
graphics.IsFullScreen = true;
答案 1 :(得分:3)
这是使用monogame的正确方法
GraphicsDeviceManager graphics;
graphics = new GraphicsDeviceManager(this);
graphics.ToggleFullScreen();
答案 2 :(得分:1)
有两种方法可以使应用程序全屏显示。一种是通过设置IsFullScreen
属性,另一种是通过调用ToggleFullScreen
方法。
请记住,根据documentation,如果您在初始化期间更改属性,这将自动设置全屏模式。但是在更改属性时(而不是在初始化时),您需要调用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();