Aracılığıyla paylaş


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 Content Gets or sets the current ContentManager.
Public Property GraphicsDevice Gets the current GraphicsDevice.
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 LaunchParameters Gets the start up parameters in LaunchParameters.
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 ResetElapsedTime Resets the elapsed time counter.
Public Method Run Call this method to initialize the game, begin running the game loop, and start processing events for the game.
Public Method RunOneFrame Run the game through what would happen in a single tick of the game clock; this method is designed for debugging only.
Public Method SuppressDraw Prevents calls to Draw until the next Update.
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.
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 LoadContent.
Protected Method LoadContent Called when graphics resources need to be loaded.
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 ShowMissingRequirementMessage This is used to display an error message if there is no suitable graphics device or sound card.
Protected Method UnloadContent Called when graphics resources need to be unloaded. Override this method to unload any game-specific graphics resources.
Protected Method Update Called when the game has determined that game logic needs to be processed.

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