UGDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
ugdk::graphic::Sprite Class Reference

#include <sprite.h>

Inheritance diagram for ugdk::graphic::Sprite:
Inheritance graph
[legend]
Collaboration diagram for ugdk::graphic::Sprite:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Sprite (const Spritesheet *spritesheet, action::AnimationSet *set=NULL)
 Sprite (const std::string &spritesheet_tag, action::AnimationSet *set=NULL)
 Sprite (const std::string &spritesheet_tag, const std::string &animation_set_tag)
 Sprite (const Spritesheet *spritesheet, const std::string &animation_set_tag)
virtual ~Sprite ()
void Update (double dt)
void Draw () const
const Vector2Dsize () const
void SelectAnimation (const std::string &animation_name)
 Change the current animation to a new animation from the previously selected AnimationSet.
void SelectAnimation (int animation_index)
 Change the current animation to a new animation from the previo2usly selected AnimationSet.
void SetAnimationSpeedupFactor (double factor)
 Change the SpeedupFactor of the animation.
void SetAnimationSlowdownFactor (double factor)
 Change the SlowdownFactor of the animation.
double GetAnimationFPS () const
 Return the animation FPS.
void AddObserverToAnimation (action::Observer *observer)
 Add a observer object to the animation.
void AddTickFunctionToAnimation (std::tr1::function< void(void)> tick)
int GetAnimationFrameNumber () const
 Return the animation frame number.
void SetDefaultFrame (int frame)
 Set the default frame.

Constructor & Destructor Documentation

ugdk::graphic::Sprite::Sprite ( const Spritesheet spritesheet,
action::AnimationSet set = NULL 
)
ugdk::graphic::Sprite::Sprite ( const std::string &  spritesheet_tag,
action::AnimationSet set = NULL 
) [explicit]
ugdk::graphic::Sprite::Sprite ( const std::string &  spritesheet_tag,
const std::string &  animation_set_tag 
) [explicit]
ugdk::graphic::Sprite::Sprite ( const Spritesheet spritesheet,
const std::string &  animation_set_tag 
) [explicit]

Member Function Documentation

Add a observer object to the animation.

Given an observer object, the function include this in the animation manager

Parameters:
*observeris a pointer to the observer object
void ugdk::graphic::Sprite::AddTickFunctionToAnimation ( std::tr1::function< void(void)>  tick) [inline]
void ugdk::graphic::Sprite::Draw ( ) const [virtual]
double ugdk::graphic::Sprite::GetAnimationFPS ( ) const [inline]

Return the animation FPS.

Return the animation FPS

Returns:
a double equivalente to the animation FPS

Return the animation frame number.

Returns:
an integer that is the animation frame number
void ugdk::graphic::Sprite::SelectAnimation ( const std::string &  animation_name) [inline]

Change the current animation to a new animation from the previously selected AnimationSet.

Given a animation name (a string), the function changes the current animation to a new animation of AnimationSet

void ugdk::graphic::Sprite::SelectAnimation ( int  animation_index) [inline]

Change the current animation to a new animation from the previo2usly selected AnimationSet.

Given a animation index (a integer), the function changes the current animation to a new animation of AnimationSet

void ugdk::graphic::Sprite::SetAnimationSlowdownFactor ( double  factor) [inline]

Change the SlowdownFactor of the animation.

Given a a factor, this function set the animation SlowdownFactor to this value

Parameters:
factoris a double
void ugdk::graphic::Sprite::SetAnimationSpeedupFactor ( double  factor) [inline]

Change the SpeedupFactor of the animation.

Given a a factor, this function set the animation SpeedupFactor to this value

Parameters:
factoris a double
void ugdk::graphic::Sprite::SetDefaultFrame ( int  frame) [inline]

Set the default frame.

Parameters:
frameis a integer
const Vector2D & ugdk::graphic::Sprite::size ( ) const [virtual]
void ugdk::graphic::Sprite::Update ( double  dt) [virtual]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines