Game Members

The following tables list the members exposed by the Game type.

Public Constructors

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

Public Properties

Name Description
Public Property Components Gets the collection of GameComponents owned by the game.
Public Property InactiveSleepTime Gets or sets the time to sleep when the game is inactive.
Public Property IsActive Indicates whether the game is currently the active application.
Public Property IsFixedTimeStep Gets or sets a value indicating whether to use fixed time steps.
Public Property IsMouseVisible Gets or sets a value indicating whether the mouse cursor should be visible.
Public Property Services Gets the GameServiceContainer holding all the service providers attached to the Game.
Public Property TargetElapsedTime Gets or sets the target time between calls to Update when IsFixedTimeStep is true.
Public Property Window Gets the underlying operating system window.

Public Methods

Name Description
Public Method Dispose Overloaded. Immediately releases the unmanaged resources used by this object.
Public Method Equals (Inherited from Object.)
Public Method Exit Exits the game.
Public Method GetHashCode (Inherited from Object.)
Public Method GetType (Inherited from Object.)
Public Method ReferenceEquals (Inherited from Object.)
Public Method Run Call this method to initialize the game, begin running the game loop, and start processing events for the game.
Public Method Tick Updates the game's clock and calls Update and Draw.
Public Method ToString (Inherited from Object.)

Protected Methods

Name Description
Protected Method BeginDraw Starts the drawing of a frame. This method is followed by calls to Draw and EndDraw.
Protected Method BeginRun Called after all components are initialized but before the first update in the game loop.
Protected Method Draw Called when the game determines it is time to draw a frame. Override this method with game-specific rendering code.
Protected Method EndDraw Ends the drawing of a frame. This method is preceeded by calls to Draw and BeginDraw.
Protected Method EndRun Called after the game loop has stopped running before exiting.
Protected Method Finalize Allows a Game to attempt to free resources and perform other cleanup operations before garbage collection reclaims the Game.
Protected Method Initialize Called after the Game and GraphicsDevice are created, but before LoadGraphicsContent.
Protected Method LoadGraphicsContent Called when graphics resources need to be loaded. Override this method to load any game-specific graphics resources.
Protected Method MemberwiseClone (Inherited from Object.)
Protected Method OnActivated Raises the Activated event. Override this method to add code to handle when the game gains focus.
Protected Method OnDeactivated Raises the Deactivated event. Override this method to add code to handle when the game loses focus.
Protected Method OnExiting Raises an Exiting event. Override this method to add code to handle when the game is exiting.
Protected Method UnloadGraphicsContent Called when graphics resources need to be unloaded. Override this method to unload any game-specifc graphics resources.
Protected Method Update Called when the game has determined that game logic needs to be processed. Override this method with game-specific logic.

Public Events

Name Description
Public Event Activated Raised when the game gains focus.
Public Event Deactivated Raised when the game loses focus.
Public Event Disposed Raised when the game is being disposed.
Public Event Exiting Raised when the game is exiting.

See Also

Reference

Game Class
Microsoft.Xna.Framework Namespace