#include <Sprite.hpp>
|
|
unsigned int | mCurrentFrame {0} |
| |
|
unsigned int | mLastFrame {7} |
| |
|
SDL_Surface * | mSpriteSheet = nullptr |
| |
|
SDL_Texture * | mTexture = nullptr |
| |
|
SDL_Rect | mSrc |
| |
|
SDL_Rect | mDest |
| |
|
int | width |
| |
|
int | height |
| |
|
int | frameCount |
| |
|
Vec2D | dimensions |
| |
|
TransformComponent * | transform |
| |
|
SDL_Renderer * | last_used = nullptr |
| |
|
|
std::vector< ComponentTag > | tags |
| |
|
std::vector< std::string > | previousBroadcasts |
| |
|
std::vector< std::string > | pendingBroadcasts |
| |
A Component implementation to load and display sprites.
◆ SpriteComponent()
Construct a new Sprite Component object
- Parameters
-
◆ ~SpriteComponent()
| SpriteComponent::~SpriteComponent |
( |
| ) |
|
◆ ComponentTypeName()
| const char * SpriteComponent::ComponentTypeName |
( |
| ) |
|
|
inlineoverridevirtual |
◆ getDimensions()
| Vec2D SpriteComponent::getDimensions |
( |
| ) |
|
Get the dimensions of the Sprite.
- Returns
- the dimensions of the Sprite
◆ LoadImage()
| void SpriteComponent::LoadImage |
( |
std::string |
filePath, |
|
|
SDL_Renderer * |
ren, |
|
|
int |
w, |
|
|
int |
h, |
|
|
int |
frames, |
|
|
Vec2D |
targetDisplay |
|
) |
| |
Load a new image to be displayed.
- Parameters
-
| filePath | the path to the imagefile (must be .bmp currently) |
| ren | the renderer to be drawn to |
| w | the width of the Sprite |
| h | the height of the Sprite |
| frames | how many frames are on the spritesheet |
| targetDisplay | how big the displayed sprite is |
◆ Render()
| void SpriteComponent::Render |
( |
SDL_Renderer * |
ren | ) |
|
|
overridevirtual |
Render the Sprite.
- Parameters
-
| ren | the SDL_Renderer to draw the sprite to |
Reimplemented from Component.
◆ ShowComponentEditor()
| void SpriteComponent::ShowComponentEditor |
( |
bool * |
showEditor | ) |
|
|
overridevirtual |
◆ Update()
| void SpriteComponent::Update |
( |
SDL_Event |
e, |
|
|
int |
frame, |
|
|
std::vector< std::string > |
broadcastList |
|
) |
| |
|
overridevirtual |
Animate the Sprite based on the frame given. Updates the state of the component object. Called by the Engine every tick
- Parameters
-
| e | any inputs given by the user |
| frame | what frame is the game currently displaying |
| broadcastList | a list to be used to send messages between components |
- See also
- ParseAndUpdateBroadcast()
Reimplemented from Component.
The documentation for this class was generated from the following files: