Chose the correct animation frame to display.
More...
|
| | this (size_t owner, SDL_Renderer *renderer, string jsonPath) |
| | Setup the renderer.
|
| |
| override void | Update () |
| | Update the current frame in the animation if enough time has passed.
|
| |
| override void | Render (SDL_Renderer *renderer, SDL_Rect *camera) |
| | Render the given component.
|
| |
| SDL_Texture * | getSpritesheet () |
| | Get the loaded spritesheet texture.
|
| |
| SDL_Rect | getCurrentFrameRect () |
| | Get the spritesheet region corresponding to the current frame.
|
| |
| void | Load (SDL_Renderer *renderer, string jsonPath) |
| | Load a texture from a .bmp file.
|
| |
|
|
SDL_Texture * | mSpritesheet |
| | The loaded SDL texture of the spritesheet.
|
| |
|
Frame[] | mFrames |
| | A list of Frame objects in the animation.
|
| |
|
int | mCurrentFrame |
| | The index of the current frame.
|
| |
|
uint | mLastFrameTime |
| | The time when the last frame was rendered.
|
| |
|
Random | rng |
| | A random generator.
|
| |
Chose the correct animation frame to display.
The rendering is done by ComponentRender.
- See also
- ComponentRender
◆ this()
| ComponentAnimation::this |
( |
size_t | owner, |
|
|
SDL_Renderer * | renderer, |
|
|
string | jsonPath ) |
|
inline |
Setup the renderer.
- Parameters
-
| owner | the id of the attached GameObject. |
| renderer | the SDL renderer object. |
| jsonPath | the JSON file defining the sprite animation parameters. |
◆ getCurrentFrameRect()
| SDL_Rect ComponentAnimation::getCurrentFrameRect |
( |
| ) |
|
|
inline |
Get the spritesheet region corresponding to the current frame.
- Returns
- An
SDL_Rect that maps to the loaded texture.
◆ getSpritesheet()
| SDL_Texture * ComponentAnimation::getSpritesheet |
( |
| ) |
|
|
inline |
Get the loaded spritesheet texture.
- Returns
- The loaded
SDL_Texture*.
◆ Load()
| void ComponentAnimation::Load |
( |
SDL_Renderer * | renderer, |
|
|
string | jsonPath ) |
|
inline |
Load a texture from a .bmp file.
- Parameters
-
| renderer | the SDL renderer object. |
| jsonPath | the JSON file defining the sprite animation parameters. |
◆ Render()
| override void ComponentAnimation::Render |
( |
SDL_Renderer * | renderer, |
|
|
SDL_Rect * | camera ) |
|
inline |
Render the given component.
Implements IComponent.
◆ Update()
| override void ComponentAnimation::Update |
( |
| ) |
|
|
inline |
The documentation for this class was generated from the following file:
- Engine/source/component.d