Class in control of animating a sprite.
More...
#include <Animation.h>
|
| | Animation (const int x_, const int y_, const int spriteWidth_, const int spriteHeight_, const int numberOfImages_, const bool loop_) |
| | The constructor. More...
|
| |
|
| ~Animation () |
| | The destructor.
|
| |
| void | update (SDL_Rect &clip_, const double dt_) |
| | Updates the animation clip. More...
|
| |
| void | changeAnimation (const int x_, const int y_, const int numberOfImages_, const bool loop_, const double totalTime_) |
| | Changes the animation to another. More...
|
| |
|
| void | updateClip (SDL_Rect &clip_, const int x_, const int y_) |
| | Updates the clip to a new position. More...
|
| |
|
|
static int | animationCount = 0 |
| |
Class in control of animating a sprite.
| Animation::Animation |
( |
const int |
x_, |
|
|
const int |
y_, |
|
|
const int |
spriteWidth_, |
|
|
const int |
spriteHeight_, |
|
|
const int |
numberOfImages_, |
|
|
const bool |
loop_ |
|
) |
| |
The constructor.
Initializes all attributes.
- Parameters
-
| x_ | : The x position on the spritesheet. |
| y_ | : The y position on the spritesheet. |
| spriteWidth_ | : The width of the sprite to animate. |
| spriteHeight_ | : The height of the sprite to animate. |
| numberOfImages_ | : The number of images to animate inside the spritesheet. |
| loop_ | : Whether to loop or not. |
| void Animation::changeAnimation |
( |
const int |
x_, |
|
|
const int |
y_, |
|
|
const int |
numberOfImages_, |
|
|
const bool |
loop_, |
|
|
const double |
totalTime_ |
|
) |
| |
| void Animation::update |
( |
SDL_Rect & |
clip_, |
|
|
const double |
dt_ |
|
) |
| |
Updates the animation clip.
- Parameters
-
| clip_ | : Reference to the clip of whatever object the animation is a part of. |
| dt_ | : Delta time. Time elapsed between one frame and the other, independent of processing speed. |
| totalTime_ | : How much time each frame should have. Affects the speed on which the animation changes. |
| void Animation::updateClip |
( |
SDL_Rect & |
clip_, |
|
|
const int |
x_, |
|
|
const int |
y_ |
|
) |
| |
|
private |
Updates the clip to a new position.
- Parameters
-
| clip_ | : The clip to update. |
| x_ | : New x position. |
| y_ | : New y position. |
Where to start/restart the animation on x.
Where to start/restart the animation on y.
| int Animation::numberOfImages |
|
private |
The number of images to animate inside the spritesheet.
| int Animation::spriteHeight |
|
private |
| int Animation::spriteWidth |
|
private |
| double Animation::totalElapsedTime |
|
private |
Total time elapsed on the animation, to check if the
frame changed.
| double Animation::totalTime |
|
private |
Total time for each animation loop.
The position on x axis on the sprite.
The position on x axis on the sprite.
The documentation for this class was generated from the following files:
- /home/caio/Git/Dauphine/include/Animation.h
- /home/caio/Git/Dauphine/src/Animation.cpp