Window in full screen


#1

Hello, how do I leave the game window in
full screen?


#2

you can press ALT+Enter on the game window.


#3

Thank you very much
This helped me a lot, but it has how to do in the code?


#4

i used something like this:

    if (GoFullscreen)
    {
        var gfxOutput = GraphicsAdapterFactory.Adapters[0].Outputs;
        var displayMode = gfxOutput[0].CurrentDisplayMode;

        var screenWidth = Math.Min(displayMode.Width, 1920);
        var maxHeight = displayMode.AspectRatio < 1.7f ? 1200 : 1080;
        var screenHeight = Math.Min(displayMode.Height, maxHeight);

        Game.GraphicsDeviceManager.PreferredBackBufferWidth = screenWidth;
        Game.GraphicsDeviceManager.PreferredBackBufferHeight = screenHeight;
        Game.GraphicsDeviceManager.IsFullScreen = true;
        Game.GraphicsDeviceManager.ApplyChanges();
    }

you can put this into some initialization code.