Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

SpriteBatch.Draw Method (Texture2D, Rectangle, Color)

Adds a sprite to the batch of sprites to be rendered, specifying the texture, destination rectangle, and color tint.

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

public void Draw (
         Texture2D texture,
         Rectangle destinationRectangle,
         Color color
)

Parameters

texture
The sprite texture.
destinationRectangle
A rectangle specifying, in screen coordinates, where the sprite will be drawn. If this rectangle is not the same size as sourcerectangle, the sprite is scaled to fit.
color
The color channel modulation to use. Use Color.White for full color with no tinting.
Exception typeCondition
ArgumentNullException texture is null.
InvalidOperationException Draw was called, but Begin has not yet been called. Begin must be called successfully before Draw can be called.

Before any calls to Draw, you must call Begin. Once all calls to Draw are complete, call End.

Xbox 360, Windows XP SP2, Windows Vista, Zune
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.