#include <gSpriteAnimator.h>
|
| | gSpriteAnimator () |
| |
| virtual | ~gSpriteAnimator () |
| |
| void | addAnimation (int animationId, gSpriteAnimation *animation) |
| |
| void | changeAnimation (int animationId) |
| |
| void | setFps (int animationId, int fps) |
| |
| void | update () |
| |
| void | draw (int x, int y) |
| |
| void | draw (int x, int y, int w, int h) |
| |
| | gObject () |
| |
| void | logi (std::string message) |
| |
| void | logd (std::string message) |
| |
| void | logw (std::string message) |
| |
| void | loge (std::string message) |
| |
| void | logi (std::string tag, std::string message) |
| |
| void | logd (std::string tag, std::string message) |
| |
| void | logw (std::string tag, std::string message) |
| |
| void | loge (std::string tag, std::string message) |
| |
An instance of this class should be created for each object that is to be animated inside the game. For example; if the developer has a character, an enemy and a door, three instances of this class should be created. Then, the object's individual animations should be added to this class by calling addAnimation.
- See also
- gSpriteAnimator::addAnimation(int, gSpriteAnimation*)
-
createSpriteAnim()
◆ gSpriteAnimator()
| gSpriteAnimator::gSpriteAnimator |
( |
| ) |
|
◆ ~gSpriteAnimator()
| virtual gSpriteAnimator::~gSpriteAnimator |
( |
| ) |
|
|
virtual |
◆ addAnimation()
| void gSpriteAnimator::addAnimation |
( |
int |
animationId, |
|
|
gSpriteAnimation * |
animation |
|
) |
| |
The first argument is just an arbitrary number that is used assigned to the animation passed as the second argument. It can be used with the changeAnimation function to change into playing another animation.
Second argument should always be created with createSpriteAnim function.
- Parameters
-
| animationId | The id that will be given to the animation that's being passed in. |
| animation | The animation object |
◆ changeAnimation()
| void gSpriteAnimator::changeAnimation |
( |
int |
animationId | ) |
|
Changes the current playing animation to the specified animation. The animationId should be the id that was assigned to the gSpriteAnimation object passed in when calling addAnimation.
- Parameters
-
◆ draw() [1/2]
| void gSpriteAnimator::draw |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
The two parameter draw function.
Call this function inside the draw function of the related Canvas. This draws the current animation on to the x and y coordinates of the screen.
- Parameters
-
| x | The x coordinate for the sprite. |
| y | The y coordinate for the sprite. |
◆ draw() [2/2]
| void gSpriteAnimator::draw |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
w, |
|
|
int |
h |
|
) |
| |
The two parameter draw function.
Call this function inside the draw function of the related Canvas. This draws the current animation on to the x and y coordinates of the screen and scales it by w and h.
- Parameters
-
| x | The x coordinate for the sprite. |
| y | The y coordinate for the sprite. |
| w | The scaling on the x axis. |
| h | The scaling on the h axis. |
◆ setFps()
| void gSpriteAnimator::setFps |
( |
int |
animationId, |
|
|
int |
fps |
|
) |
| |
Sets the fps of the given animation.
- Parameters
-
◆ update()
| void gSpriteAnimator::update |
( |
| ) |
|
Call this update inside the related Canvas's update function.
The documentation for this class was generated from the following file: