AnimatedSprite Class Reference

AnimatedSprite management class. More...

#include <Engine/AnimatedSprite.h>

List of all members.

Public Member Functions

 AnimatedSprite (NE::Sprite *pSprite, const USize2 &spriteSize, const unsigned int msInterval)
 AnimatedSprite (NE::SpriteLoader *pSL, const std::string &fileName, const USize2 &spriteSize, const unsigned int msInterval)
 Create an animation from a file.
Rect getSrcRect (const unsigned int time)
 Get the source rectangle for the internal surface, to draw Following the current frame, the rectangle to draw will be returned.
USize2 getSize (void) const
 Get the size of the animated sprite.
unsigned int getInterval (void) const
 Get the interval between two frames.
void setInterval (const unsigned int newInterval)
 Set the interval between two frames.
bool draw (const NE::Renderer &r, const IVec2 &position, const unsigned int time=0)
 Draw the Sprite at position.
bool draw (const NE::Renderer &r, const IVec2 &position, const Colour &mask, const unsigned int time=0)
 Draw the Sprite at position.

Detailed Description

AnimatedSprite management class.

Inherits from the Sprite class to handle the case of set of sprites to do animation Can do the following:


Constructor & Destructor Documentation

AnimatedSprite::AnimatedSprite ( NE::Sprite pSprite,
const USize2 spriteSize,
const unsigned int  msInterval 
)

Do an animation using a Sprite. The animated sprite size is given by spriteSize.

Parameters:
pSprite the Sprite to use for the animation
spriteSize the size of the sprite
msInterval interval between two sprite in milliseconds
AnimatedSprite::AnimatedSprite ( NE::SpriteLoader pSL,
const std::string &  fileName,
const USize2 spriteSize,
const unsigned int  msInterval 
)

Create an animation from a file.

Parameters:
pSL pointer to the SpriteLoader to use
fileName the file to load as an AnimatedSprite
spriteSize the size of each sprite
msInterval the time between two sprites

Member Function Documentation

bool AnimatedSprite::draw ( const NE::Renderer r,
const IVec2 position,
const Colour mask,
const unsigned int  time = 0 
)

Draw the Sprite at position.

Parameters:
r the NE::Renderer to use to draw the AnimatedSprite
position where to draw the sprite
mask mask to use when drawing the sprite
time time of the animation
Returns:
true if all goes right
bool AnimatedSprite::draw ( const NE::Renderer r,
const IVec2 position,
const unsigned int  time = 0 
)

Draw the Sprite at position.

Parameters:
r the NE::Renderer to use to draw the AnimatedSprite
position where to draw the sprite
time time of the animation
Returns:
true if all goes right
unsigned int AnimatedSprite::getInterval ( void   )  const [inline]

Get the interval between two frames.

Returns:
returns the interval in millisecond
USize2 AnimatedSprite::getSize ( void   )  const [inline]

Get the size of the animated sprite.

Returns:
returns the size of the animated sprite
SDL_Rect AnimatedSprite::getSrcRect ( const unsigned int  time  ) 

Get the source rectangle for the internal surface, to draw Following the current frame, the rectangle to draw will be returned.

Parameters:
time the actual time
void AnimatedSprite::setInterval ( const unsigned int  newInterval  )  [inline]

Set the interval between two frames.

Parameters:
newInterval the new interval in millisecond

The documentation for this class was generated from the following files:
 All Classes Functions Variables Typedefs
Generated on Thu Oct 6 22:11:38 2011 for WE_Kit by  doxygen 1.6.3