phoenix::PhSpriteAnimation Class Reference

Sprite Animation. More...

#include <PhSpriteAnimation.h>

Inheritance diagram for phoenix::PhSpriteAnimation:

phoenix::PhSceneNode

List of all members.

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.
PhTexturegetTexture ()
 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.


Detailed Description

Sprite Animation.

This class provides a simple way to create simple sprite animations.


Constructor & Destructor Documentation

phoenix::PhSpriteAnimation::PhSpriteAnimation ( PhSceneManager s  ) 

Constructor.

Makes a blank sprite animation.

Parameters:
s A scenemanager.

phoenix::PhSpriteAnimation::PhSpriteAnimation ( PhSceneManager s,
PhTexture t,
PhVector2d  a,
PhVector2d  p = PhVector2d(0.0f, 0.0f) 
)

Constructor.

Makes a sprite animation.

Parameters:
s A scenemanager.
t Texture of the sprite sheet.
a Size of one cell (sprite).
p Position.


Member Function Documentation

void phoenix::PhSpriteAnimation::setTexture ( PhTexture t  ) 

Set texture.

Parameters:
t New texture.
See also:
getTexture()

PhTexture* phoenix::PhSpriteAnimation::getTexture (  ) 

GEt Texture.

Returns:
The current texture.
See also:
setTexture()

void phoenix::PhSpriteAnimation::setAnimation ( int  b,
int  e 
)

Set animation.

Sets the bounding frames of the animation.

Parameters:
b The begining frame.
e The ending frame.

void phoenix::PhSpriteAnimation::setFrame ( int  a  ) 

Set frame.

Forces the frame to change.

Parameters:
a The desired frame number.
See also:
getFrame()

int phoenix::PhSpriteAnimation::getFrame (  ) 

Get frame.

Returns:
The current frame.
See also:
setFrame()

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.

Note:
The speed is dependent on framerate.
Parameters:
a The animation speed.
See also:
getAnimationSpeed()

float phoenix::PhSpriteAnimation::getAnimationSpeed (  ) 

Get animation speed.

Returns:
The current animation speed.
See also:
setAnimationSpeed()

void phoenix::PhSpriteAnimation::setFrameSize ( PhVector2d  s  ) 

Set frame size.

Sets the current size of one frame (cell) of animation.

Parameters:
s The new cell size.
See also:
getFrameSize()

PhVector2d phoenix::PhSpriteAnimation::getFrameSize (  ) 

Get frame size.

Returns:
The current frame (cell) size.
See also:
setFrameSize()

void phoenix::PhSpriteAnimation::setPosition ( PhVector2d  s  ) 

Set position.

Parameters:
s The new position.
See also:
getPosition()

PhVector2d phoenix::PhSpriteAnimation::getPosition (  ) 

Get position.

Returns:
The current position.
See also:
setPosition()

float phoenix::PhSpriteAnimation::getRotation (  ) 

Get rotation.

Returns:
The current rotation (in degrees).

void phoenix::PhSpriteAnimation::setRotation ( float  r  ) 

Set rotation.

Parameters:
r New rotation (in degrees).

bool phoenix::PhSpriteAnimation::getFlip (  ) 

Get flip.

Returns:
If the sprite is being flipped.

void phoenix::PhSpriteAnimation::setFlip ( bool  f  ) 

Set flip.

Parameters:
f Pass true to flip the sprite.

PhColor phoenix::PhSpriteAnimation::getColor (  ) 

Get color.

Returns:
The current blending color.

void phoenix::PhSpriteAnimation::setColor ( PhColor  c  ) 

Set color.

Parameters:
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.


The documentation for this class was generated from the following file:
Generated on Tue Nov 20 21:59:25 2007 for Phoenix by  doxygen 1.5.4