共用方式為


Game.Run Method

Call this method to initialize the game, begin running the game loop, and start processing events for the game.

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

Syntax

public void Run ()

Exceptions

Exception type Condition
InvalidOperationException Run has been called multiple times in the same application.
ArgumentException

Invalid arguments have been requested for the creation of the graphics device.

Invalid back buffer options have been requested:

Invalid PresentationParameters.PresentationInterval or SwapEffect options have been requested:

Invalid multisampling options have been requested:

Invalid depth stencil options have been requested:

IsFullScreen is true, but:

IsFullScreen is false, but:

Remarks

This method calls the game Initialize and BeginRun methods before it begins the game loop and starts processing events for the game.

Example

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

See Also

Reference

Game Class
Game Members
Microsoft.Xna.Framework Namespace

Programming Guide

Application Model Overview

Platforms

Xbox 360, Windows XP SP2, Windows Vista