Draw the sprite to a render target.
Get the global bounding rectangle of the entity.
Get the local bounding rectangle of the entity.
Get the source texture of the sprite.
Change the source texture of the shape.
The global color of the sprite.
Create a new Sprite with the same data. Note that the texture is not copied, only its reference.
The sub-rectangle of the texture that the sprite will display.
The local origin of the object.
The position of the object. The default is (0, 0).
The orientation of the object, in degrees. The default is 0 degrees.
The scale factors of the object. The default is (1, 1).
Get the inverse of the combined transform of the object.
Get the combined transform of the object.
Move the object by a given offset.
Draw the object to a render target.
The local origin of the object.
The position of the object. The default is (0, 0).
The orientation of the object, in degrees. The default is 0 degrees.
The scale factors of the object. The default is (1, 1).
Get the inverse of the combined transform of the object.
Get the combined transform of the object.
Move the object by a given offset.
Drawable representation of a texture, with its own transformations, color, etc.
Sprite is a drawable class that allows to easily display a texture (or a part of it) on a render target.
It inherits all the functions from Transformable: position, rotation, scale, origin. It also adds sprite-specific properties such as the texture to use, the part of it to display, and some convenience functions to change the overall color of the sprite, or to get its bounding rectangle.
Sprite works in combination with the Texture class, which loads and provides the pixel data of a given texture.
The separation of Sprite and Texture allows more flexibility and better performances: indeed a Texture is a heavy resource, and any operation on it is slow (often too slow for real-time applications). On the other side, a Sprite is a lightweight object which can use the pixel data of a Texture and draw it with its own transformation/color/blending attributes.
It is important to note that the Sprite instance doesn't copy the texture that it uses, it only keeps a reference to it. Thus, a Texture must not be destroyed while it is used by a Sprite (i.e. never write a function that uses a local Texture instance for creating a sprite).