1

好的,我想要的是在我之后从窗口模式切换到全屏的代码,gameState.gameLoading所以下一个gameState.mainMenu状态是全屏。我怎么做?我的代码是:变量:

    //Game States
    public enum gameState
    {
        gameLoading,
        mainMenu,
        gameOptions,
        levelSelect,
        gamePlaying,
        gameOver
    }
    gameState CurrentGameState = gameState.gameLoading;

Update()方法:

        if (CurrentGameState != gameState.gameLoading)
        {
            IsMouseVisible = false;
            graphics.IsFullScreen = true;
        }
        if (CurrentGameState == gameState.gameLoading)
        {
            IsMouseVisible = true;
            graphics.IsFullScreen = false;
        }

但它不起作用。有什么建议么?

4

3 回答 3

1

您需要应用图形更改,如下所示:

graphics.IsFullScreen = true;
graphics.ApplyChanges();
// profit
于 2013-08-22T16:21:52.333 回答
0

在这里,您可以检查graphics.ToggleFullScreen()用于修复它的异常。

于 2013-08-22T15:46:14.583 回答
0

我找到的解决方案是:

        //Update() method
        if (CurrentGameState == gameState.gameLoading)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Enter))
            {
                graphics.ToggleFullScreen(); //?
            }
            graphics.ApplyChanges();
        }
于 2013-08-24T14:18:42.320 回答