#include <PhSpriteAnimation.h>
Public Member Functions | |
PhSpriteAnimation (PhSceneManager *s) | |
Constructor. | |
PhSpriteAnimation (PhSceneManager *s, PhTexture *t, PhVector2d a, PhVector2d p=PhVector2d(0.0f, 0.0f)) | |
Constructor. | |
~PhSpriteAnimation () | |
Destructor. | |
void | setTexture (PhTexture *t) |
Set texture. | |
PhTexture * | getTexture () |
GEt Texture. | |
void | setAnimation (int b, int e) |
Set animation. | |
void | setFrame (int a) |
Set frame. | |
int | getFrame () |
Get frame. | |
void | setAnimationSpeed (float a) |
Set animation speed. | |
float | getAnimationSpeed () |
Get animation speed. | |
void | setFrameSize (PhVector2d s) |
Set frame size. | |
PhVector2d | getFrameSize () |
Get frame size. | |
void | setPosition (PhVector2d s) |
Set position. | |
PhVector2d | getPosition () |
Get position. | |
float | getRotation () |
Get rotation. | |
void | setRotation (float r) |
Set rotation. | |
bool | getFlip () |
Get flip. | |
void | setFlip (bool f) |
Set flip. | |
PhColor | getColor () |
Get color. | |
void | setColor (PhColor c) |
Set color. | |
void | enable () |
Enable. | |
void | disable () |
Disable. | |
void | onPreRender () |
Pre-render call. | |
void | onRender () |
Render call. | |
void | onPostRender () |
Post-render call. |
This class provides a simple way to create simple sprite animations.
phoenix::PhSpriteAnimation::PhSpriteAnimation | ( | PhSceneManager * | s | ) |
Constructor.
Makes a blank sprite animation.
s | A scenemanager. |
phoenix::PhSpriteAnimation::PhSpriteAnimation | ( | PhSceneManager * | s, | |
PhTexture * | t, | |||
PhVector2d | a, | |||
PhVector2d | p = PhVector2d(0.0f, 0.0f) | |||
) |
Constructor.
Makes a sprite animation.
s | A scenemanager. | |
t | Texture of the sprite sheet. | |
a | Size of one cell (sprite). | |
p | Position. |
void phoenix::PhSpriteAnimation::setTexture | ( | PhTexture * | t | ) |
PhTexture* phoenix::PhSpriteAnimation::getTexture | ( | ) |
void phoenix::PhSpriteAnimation::setAnimation | ( | int | b, | |
int | e | |||
) |
Set animation.
Sets the bounding frames of the animation.
b | The begining frame. | |
e | The ending frame. |
void phoenix::PhSpriteAnimation::setFrame | ( | int | a | ) |
int phoenix::PhSpriteAnimation::getFrame | ( | ) |
void phoenix::PhSpriteAnimation::setAnimationSpeed | ( | float | a | ) |
Set animation speed.
Sets the animation speed, animation speed of 1.0f has no skipping frames. Values above 1.0f may skip frames, values below 1.0f will make frames last longer.
a | The animation speed. |
float phoenix::PhSpriteAnimation::getAnimationSpeed | ( | ) |
void phoenix::PhSpriteAnimation::setFrameSize | ( | PhVector2d | s | ) |
Set frame size.
Sets the current size of one frame (cell) of animation.
s | The new cell size. |
PhVector2d phoenix::PhSpriteAnimation::getFrameSize | ( | ) |
void phoenix::PhSpriteAnimation::setPosition | ( | PhVector2d | s | ) |
PhVector2d phoenix::PhSpriteAnimation::getPosition | ( | ) |
float phoenix::PhSpriteAnimation::getRotation | ( | ) |
Get rotation.
void phoenix::PhSpriteAnimation::setRotation | ( | float | r | ) |
Set rotation.
r | New rotation (in degrees). |
bool phoenix::PhSpriteAnimation::getFlip | ( | ) |
Get flip.
void phoenix::PhSpriteAnimation::setFlip | ( | bool | f | ) |
Set flip.
f | Pass true to flip the sprite. |
PhColor phoenix::PhSpriteAnimation::getColor | ( | ) |
Get color.
void phoenix::PhSpriteAnimation::setColor | ( | PhColor | c | ) |
Set color.
c | The new blending color. |
void phoenix::PhSpriteAnimation::enable | ( | ) |
Enable.
Enables this sprite.
void phoenix::PhSpriteAnimation::disable | ( | ) |
Disable.
Disables this sprite.
void phoenix::PhSpriteAnimation::onPreRender | ( | ) | [virtual] |
Pre-render call.
All nodes in the list will have this function called by the scenemanger once per frame. Overloading this is required. If the scene node wants to be drawn it must call phoenix::PhSceneManger::registerForRendering().
Reimplemented from phoenix::PhSceneNode.
void phoenix::PhSpriteAnimation::onRender | ( | ) | [virtual] |
Render call.
Any nodes that called phoenix::PhSceneManger::registerForRendering() will first be sorted according to their depth, then this function is called for each node in order. It is highly suggested that you put any drawing code in this function. Of course, it's possible to draw during any of the three node passes, but this pass is the only one that is exclusive (Nodes must register) and is the only one that is depth sorted.
Reimplemented from phoenix::PhSceneNode.
void phoenix::PhSpriteAnimation::onPostRender | ( | ) | [virtual] |
Post-render call.
The third render pass takes place at the end of every frame, the scene manager calls this function for every node in the list, and any code that should happen after everything is drawn should go here.
Reimplemented from phoenix::PhSceneNode.