UGDK  0.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ugdk::graphic::Sprite Class Reference

#include <ugdk/graphic/drawable/sprite.h>

Inheritance diagram for ugdk::graphic::Sprite:
Collaboration diagram for ugdk::graphic::Sprite:

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.
 
- Public Member Functions inherited from ugdk::graphic::Drawable
virtual ~Drawable ()
 
void set_hotspot (const Vector2D &hotspot)
 
void set_hotspot (const HookPoint &hook)
 
const double width () const
 
const double height () const
 
const Vector2Dhotspot () const
 

Additional Inherited Members

- Public Types inherited from ugdk::graphic::Drawable
enum  HookPoint {
  TOP_LEFT, TOP, TOP_RIGHT, LEFT,
  CENTER, RIGHT, BOTTOM_LEFT, BOTTOM,
  BOTTOM_RIGHT
}
 
- Protected Member Functions inherited from ugdk::graphic::Drawable
 Drawable ()
 
- Protected Attributes inherited from ugdk::graphic::Drawable
ugdk::Vector2D hotspot_
 

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
ugdk::graphic::Sprite::~Sprite ( )
virtual

Member Function Documentation

void ugdk::graphic::Sprite::AddObserverToAnimation ( action::Observer observer)
inline

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
int ugdk::graphic::Sprite::GetAnimationFrameNumber ( ) const
inline

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: