2D Graphics

Discusses the basics of 2D rendering and includes examples of how to display sprites.

In This Section

2D Graphics Overview
Summarizes the basics of using sprites.
How To: Draw a Sprite
Demonstrates how to draw a sprite by using the SpriteBatch class.
How To: Animate a Sprite
Demonstrates how to animate a sprite from a texture using a custom class.
How To: Draw a Masked Sprite over a Background
Demonstrates how to draw a foreground and background sprite using the SpriteBatch class, where only part of the foreground sprite masks the background.
How To: Make a Scrolling Background
Demonstrates how to draw a scrolling background sprite using the SpriteBatch class.
How To: Rotate a Sprite
Demonstrates how to rotate a sprite around its center.
How To: Rotate a Group of Sprites
Demonstrates how to rotate a group of sprites around a single point using a rotation Matrix.
How To: Scale a Sprite
Demonstrates how to scale a sprite using a uniform scale, nonuniform scale, or a destination rectangle.
How To: Tile a Sprite
Demonstrates how to draw a sprite repeatedly in the x and y directions in one Draw call.
How To: Tint a Sprite
Demonstrates how to tint a sprite using a Color value.
How To: Scale Sprites Based On Screen Size
Demonstrates how to scale sprites using a matrix that is created based on the viewport width.
How To: Draw Point Sprites
Demonstrates how to create and draw point sprites.
How To: Apply a Pixel Shader to Sprites
Demonstrates how to apply a pixel shader to sprites.
How To: Draw a Sprite Over a Model
Demonstrates how to draw a sprite so that it obscures a model.
How To: Draw Text
Demonstrates how to import a SpriteFont into a project and draw text using DrawString.

Concepts

Community Additions

ADD
Show: