Skip to content

Latest commit

 

History

History
53 lines (36 loc) · 2.42 KB

File metadata and controls

53 lines (36 loc) · 2.42 KB
title description requireMSLicense
How to create a Full-Screen Game
Demonstrates how to start a game in full-screen mode.
true

Overview

By default, MonoGame will render in a Window pre-set to the default (800 x 480) resolution. If you instead want to render to the full screen, then is it as simple as flipping a switch and the renderer will use the full dimensions of the targeted display device.

Note

Rendering to the full screen does NOT change the resolution that the game will be drawn in, that is something as a game developer you have to control. This is because the resolution the game draws at will have a direct impact on the content you are rendering, so you need to best control what gets drawn and how.

To create a full-screen game

  1. Derive a class from Game.

  2. After creating the GraphicsDeviceManager, set its PreferredBackBufferWidth and PreferredBackBufferHeight to the desired screen height and width.

    [!NOTE] Check the What Is 3D Rendering? guide on the various ways the GraphicsDevice and Back Buffer? can be initialized.

  3. Set IsFullScreen to true.

    public Game1()
    {
        _graphics = new GraphicsDeviceManager(this);
        // Setup up the default resolution for the project
        _graphics.PreferredBackBufferWidth = 800;
        _graphics.PreferredBackBufferHeight = 480;
    
        // Runs the game in "full Screen" mode using the set resolution
        _graphics.IsFullScreen = true;
    
        Content.RootDirectory = "Content";
        IsMouseVisible = true;
    }

See Also

Concepts

Reference

  • GraphicsDeviceManager