Game.Draw Method
Called when the game determines it is time to draw a frame. Override this method with game-specific rendering code.
Syntax
'Declaration
Protected Overridable Sub Draw ( _
gameTime As GameTime _
)
protected virtual void Draw (
GameTime gameTime
)
protected:
virtual void Draw(
GameTime gameTime
)
Parameters
- gameTime
Type: GameTime
Time passed since the last call to Draw.
Remarks
Update and Draw are called at different rates depending on whether IsFixedTimeStep is true or false. If IsFixedTimeStep is false, Update and Draw will be called sequentially as often as possible. If IsFixedTimeStep is true, Update will be called at the interval specified in TargetElapsedTime, while Draw will continue to be called as often as possible.
Example
In classes that derive from Game, it is necessary to make these calls:
- Call base.Draw in Draw to enumerate through any graphics components that have been added to Components. This method will automatically call the Initialize method for every component that has been added to the collection.
protected override void Draw( GameTime gameTime ) { base.Draw( gameTime ); }
Requirements
Namespace: Microsoft.Xna.Framework
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
See Also
Concepts
Game State Management Sample at App Hub Online
Reference
Game Class
Game Members
Microsoft.Xna.Framework Namespace
Platforms
Windows Phone