SpriteBatch.Draw Method (Texture2D, Vector2, Color)
Adds a sprite to a batch of sprites for rendering using the specified texture, position and color.
Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework.Graphics (in microsoft.xna.framework.graphics.dll)
Syntax
public void Draw (
Texture2D texture,
Vector2 position,
Color color
)
Parameters
- texture
A texture. - position
The location (in screen coordinates) to draw the sprite. - color
The color to tint a sprite. Use Color.White for full color with no tinting.
Exceptions
Exception type | Condition |
---|---|
ArgumentNullException | texture is null. |
InvalidOperationException | Draw was called, but Begin has not yet been called. Begin must be called successfully before you can call Draw. |
Remarks
Before making any calls to Draw, you must call Begin. Once all calls to Draw are complete, call End.
See Also
Tasks
Concepts
Reference
SpriteBatch Class
SpriteBatch Members
Microsoft.Xna.Framework.Graphics Namespace
Platforms
Xbox 360, Windows 7, Windows Vista, Windows XP, Windows Phone 7