2D Graphics
This section discusses the basics of 2D rendering and includes examples of how to display sprites.
In This Section
- 2D Graphics Overview
Presents the basics of using sprites. - How to: Animate a Sprite
This article demonstrates how to animate a sprite from a texture using a custom class. - How to: Make a Texture with Masking
This article explains how to make a texture with a masking (transparency) layer using either .png or .bmp format files and the DirectX Texture Tool. The DirectX Texture Tool is one of the utilities included in the DirectX SDK. - How to: Draw a Masked Sprite over a Background
This article demonstrates how to draw a foreground and background sprite using the SpriteBatch class, where only part of the foreground sprite masks the background. The foreground sprite in this example must have masking information as described in How to: Make a Texture with Masking. - How to: Make a Scrolling Background
This article demonstrates how to draw a scrolling background sprite using the SpriteBatch class. - How to: Rotate a Sprite
This article demonstrates how to rotate a sprite around its center. - How to: Rotate a Group of Sprites
This article demonstrates how to rotate a group of sprites around a single point using a rotation Matrix. It uses two methods; rotating the sprite positions manually during Update, and creating a rotation matrix during Update that SpriteBatch can use during Draw. - How to: Scale a Sprite
This article demonstrates how to scale a sprite using a uniform scale, nonuniform scale, or a destination rectangle. - How to: Tint a Sprite
This article demonstrates how to tint a sprite using a Color value. - How to: Scale Sprites Based On Screen Size
This article demonstrates how to scale sprites using a Matrix that is created based on the Viewport width. This article applies only to Windows programming. - How to: Draw Point Sprites
This article demonstrates how to create and draw point sprites. - How to: Apply a Pixel Shader to Sprites
This article demonstrates how to apply a pixel shader to sprites. - How to: Draw a Sprite Over a Model
This article demonstrates how to draw a sprite so that it obscures a model.