Sprites and sprite sheets
As far as XNA and the SpriteBatch class are concerned, a sprite is a 2D bitmapped image that can be drawn either with or without transparency information to the screen.
Tip
Sprites vs. Textures
XNA defines a "sprite" as a 2D bitmap that is drawn directly to the screen. While these bitmaps are stored in Texture2D
objects, the term "texture" is used when a 2D image is mapped onto a 3D object, providing a visual representation of the surface of the object. In practice, all XNA graphics are actually performed in 3D, with 2D sprites being rendered via special configurations of the XNA rendering engine.
The simple form of the SpriteBatch.Draw()
call that you used in Chapter 1 when drawing squares only needed three parameters: a Texture2D
to draw, a Rectangle
indicating where to draw it, and a Color
to specify the tint to overlay onto the sprite.
Other overloads of the Draw()
method, however, also allow you to specify a Rectangle
representing the source area within the Texture2D...