XNA – Display a Game in Full-Screen Mode

June 22, 2009 5:03 AM Published by

The Complete Sample

The code in this topic shows you the technique. You can download a complete code sample for this topic, including full source code and any additional supporting files required by the sample.

Starting a Game in Full-Screen Mode

To start a game in full-screen mode

  1. Derive a class from Game.

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

  3. Set IsFullScreen to true.

    C#
public Game1()
{    
this.graphics.PreferredBackBufferWidth = 800;    
this.graphics.PreferredBackBufferHeight = 600;    
this.graphics.IsFullScreen = true;
}	
 
http://msdn.microsoft.com/en-us/library/bb195024.aspx

Categorised in:


Tag Cloud