Export (0) Print
Expand All

Game Constructor

Initializes a new instance of this class, which provides basic graphics device initialization, game logic, rendering code, and a game loop.

Namespace: Microsoft.Xna.Framework
Assembly: Microsoft.Xna.Framework.Game (in microsoft.xna.framework.game.dll)

public Game ()

Although the GraphicsDeviceManager constructor requires an instance of Game, if the application does not otherwise require an instance of Game it is often more desirable to implement the IGraphicsDeviceService interface to provide the same services that would be provided by the GraphicsDeviceManager.

Similarly, when creating a new ContentManager, if no instance of Game is otherwise required by the application, it is often more desirable to create a new class that implements the IServiceProvider interface rather than creating an instance of Game just to create a new instance of GraphicsDeviceManager.

/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args)
{
    using (Game1 game = new Game1())
    {
        game.Run();
    }
}     
    

Xbox 360, Windows XP SP2, Windows Vista

Community Additions

ADD
Show:
© 2014 Microsoft