Drawable sprite using a Texture as its drawable resource. Part of the Decorator pattern along with the Drawable class.
More...
#include <Sprite.hpp>
Drawable sprite using a Texture as its drawable resource. Part of the Decorator pattern along with the Drawable class.
◆ Sprite() [1/3]
◆ Sprite() [2/3]
pk::Sprite::Sprite |
( |
Texture *const |
texture | ) |
|
◆ Sprite() [3/3]
pk::Sprite::Sprite |
( |
Texture *const |
texture, |
|
|
const SDL_Rect & |
rect |
|
) |
| |
◆ ~Sprite()
virtual pk::Sprite::~Sprite |
( |
| ) |
|
|
virtual |
◆ draw()
void pk::Sprite::draw |
( |
SDL_Renderer *const |
renderTarget, |
|
|
SDL_Rect *const |
renderTargetRect |
|
) |
| |
|
overridevirtual |
Draw the Sprite to a render target.
- Parameters
-
SDL_Renderer | * const renderTarget - the renderer to draw with. |
SDL_Rect | * const renderTargetRect - the area of the render target to draw to. |
Implements pk::Drawable.
◆ getBoundsRect()
const SDL_Rect & pk::Sprite::getBoundsRect |
( |
| ) |
|
|
inline |
Get the current bounding rectangle of the Sprite.
- Returns
- SDL_Point - an SDL_Rect corresponding to the bounding rectangle of the Sprite.
◆ getCenter()
SDL_Point pk::Sprite::getCenter |
( |
| ) |
|
|
inline |
Get the current center point of the Sprite.
- Returns
- SDL_Point - an SDL_Point corresponding to the current center point of the Sprite.
◆ getFlip()
const SDL_RendererFlip & pk::Sprite::getFlip |
( |
| ) |
|
|
inline |
Get the current flip type for the Sprite (default is SDL_FLIP_NONE).
- Returns
- SDL_RendererFlip & - a const reference to an SDL_RendererFlip constant (SDL_FLIP_NONE, SDL_FLIP_HORIZONTAL, SDL_FLIP_VERTICAL).
◆ getSpriteData()
◆ getTexture()
Texture *const pk::Sprite::getTexture |
( |
| ) |
|
|
inline |
◆ setBoundsRect()
void pk::Sprite::setBoundsRect |
( |
SDL_Rect & |
rect | ) |
|
|
inline |
Set the bounding rectangle for the Sprite.
- Parameters
-
SDL_Rect | &rect - an SDL_Rect you want to set the bounding rectangle of the Sprite to. |
◆ setFlip()
void pk::Sprite::setFlip |
( |
SDL_RendererFlip & |
type | ) |
|
|
inline |
Set the flip type for the Sprite (SDL_FLIP_NONE, SDL_FLIP_HORIZONTAL, SDL_FLIP_VERTICAL).
- Parameters
-
SDL_RendererFlip | type - an integer corresponding to an SDL_RendererFlip constant. |
◆ setSpriteData()
Set the data for the Sprite object.
- Parameters
-
◆ setTexture()
pk::Sprite::setTexture |
( |
Texture *const |
texture | ) |
|
|
inline |
Set the Sprite texture.
- Parameters
-
◆ updateSprite()
pk::Sprite::updateSprite |
( |
| ) |
|
|
private |
Used internally when the render mode is initialized or changed.
◆ m_data
Data important to the construction and state maintenance of a Sprite.
The documentation for this class was generated from the following file: