sfAnimatedSprite Class Reference

#include <AnimatedSprite.hpp>

Inheritance diagram for sfAnimatedSprite:

sfSprite sfDrawable List of all members.

Public Member Functions

 sfAnimatedSprite (const sfImage *Img=NULL)
 sfAnimatedSprite (const sfImage *Img, const sfIntRect &SourceRect, unsigned int FrameWidth, unsigned int FrameHeight)
void CreateAnimation (const sfImage *Img, const sfIntRect &SourceRect, unsigned int FrameWidth, unsigned int FrameHeight)
void AddFrame (const sfIntRect &FrameRect, int Index=-1)

Public Attributes

float Timing
 Time between two frames of animation (in seconds).

Protected Member Functions

virtual void Render (sfRenderWindow &Window)

Detailed Description

sfAnimatedSprite defines an animated sprite, ie. a sequences of sprites

Definition at line 44 of file AnimatedSprite.hpp.


Constructor & Destructor Documentation

sfAnimatedSprite::sfAnimatedSprite ( const sfImage Img = NULL  ) 

Default constructor

Parameters:
Img : Image containing sprite frames (NULL by default)

Definition at line 35 of file AnimatedSprite.cpp.

sfAnimatedSprite::sfAnimatedSprite ( const sfImage Img,
const sfIntRect SourceRect,
unsigned int  FrameWidth,
unsigned int  FrameHeight 
)

Construct the animated sprite from its parameters

Parameters:
Img : Image containing sprite frames
SourceRect : Sub-rectangle contaning frames in source image
FrameWidth : Width of one frame of animation, in pixels
FrameHeight : Height of one frame of animation, in pixels

Definition at line 47 of file AnimatedSprite.cpp.

References CreateAnimation().


Member Function Documentation

void sfAnimatedSprite::CreateAnimation ( const sfImage Img,
const sfIntRect SourceRect,
unsigned int  FrameWidth,
unsigned int  FrameHeight 
)

Create the animated sprite

Parameters:
Img : Image containing sprite frames
SourceRect : Sub-rectangle contaning frames in source image
FrameWidth : Width of one frame of animation, in pixels
FrameHeight : Height of one frame of animation, in pixels

Definition at line 59 of file AnimatedSprite.cpp.

References AddFrame(), sfRect< T >::GetHeight(), sfRect< T >::GetWidth(), sfSprite::Image, sfRect< T >::Left, and sfRect< T >::Top.

Referenced by sfAnimatedSprite().

void sfAnimatedSprite::AddFrame ( const sfIntRect FrameRect,
int  Index = -1 
)

Add a frame to the animation, defined as a sub-rectangle of source image

Parameters:
FrameRect : Rectangle defining the frame
Index : Index of insertion (-1 by default, means at the end)

Definition at line 87 of file AnimatedSprite.cpp.

References sfSprite::SubRect.

Referenced by CreateAnimation().

void sfAnimatedSprite::Render ( sfRenderWindow Window  )  [protected, virtual]

/see sfDrawable::Render

Reimplemented from sfSprite.

Definition at line 121 of file AnimatedSprite.cpp.

References sfClock::GetElapsedTime(), sfSprite::Render(), sfClock::Reset(), sfSprite::SubRect, and Timing.


The documentation for this class was generated from the following files:
Generated for SFML by  doxygen 1.5.2