Yukino::Sprite Class Reference

Class to store one sprite animated. More...

#include <Sprite.h>

Inheritance diagram for Yukino::Sprite:

Yukino::Surface List of all members.

Public Member Functions

 Sprite ()
 Constructor of the Sprite class.
 Sprite (int w, int h, int bpp, dword fps, int cols, int rows=1)
 Constructor of the Sprite class.
 Sprite (int w, int h, int bpp, dword fps, vector< RectAux > &frames)
 Constructor of the Sprite class.
 Sprite (const string &file)
 Constructor of the Sprite class.
 Sprite (const char *file)
 Constructor of the Sprite class.
 Sprite (const Sprite &obj)
 Copy constructor of the Sprite class.
virtual Spriteoperator= (Sprite &obj)
 Operator = of the Sprite class.
 ~Sprite ()
 Destructor of the Sprite class.
UINT Create (int w, int h, int bpp, dword fps, int cols, int rows=1)
 Function to create a blank sprite in the Sprite.
UINT Create (int w, int h, int bpp, dword fps, vector< RectAux > &frames)
 Function to create a blank sprite in the Sprite.
virtual UINT Load (const char *file)
 Function to load a sprite from a file.
virtual UINT Load (const string &file)
 Function to load a sprite from a file.
virtual UINT Save (const char *file, const char *texture)
 Function to save a sprite in a file.
virtual UINT Save (const string &file, const string &texture)
 Function to save a sprite in a file.
virtual void Free (void)
 Function to release the data of the Sprite object.
dword GetFPS (void)
 Function to obtain the number of frames per second.
void SetFPS (dword fps)
 Function to change the number of frames per second.
bool SetNumFrames (int cols, int rows)
 Function to change the number of frames of the animation.
bool SetNumFrames (int numframes)
 Function to change the number of frames of the animation.
int GetNumFrames (void) const
 Function to obtain the number of frames of the animation.
void SetFrames (vector< RectAux > &frames)
 Function to change the frames of the animation.
void SetFrame (word i, sword x, sword y, word w, word h)
 Function to change one frame of the animation.
void SetFrame (word i, const Rect *frame)
 Function to change one frame of the animation.
void GetFrame (word i, Rect *frame) const
 Function to obtain one frame of the animation.
void SetActFrame (dword frame)
 Function to change the actual frame of the animation.
dword GetActFrame (void) const
 Function to obtain the actual frame of the animation.
void NextActFrame (void)
 Function to pass to the next frame of the animation.
void Update (dword time)
 Function to update the actual frame of the animation.
void ResetTime (void)
 Function to reset the passed time.

Detailed Description

Class to store one sprite animated.

The Sprite class serves to store in memory sprite animated, contained the information of this in two files. One of specification of frames of the animation, and another one with the image where they are frames.


Constructor & Destructor Documentation

Yukino::Sprite::Sprite (  ) 

Constructor of the Sprite class.

Constructor by defect of the Sprite class.

See also:
operator=(), ~Sprite().

Yukino::Sprite::Sprite ( int  w,
int  h,
int  bpp,
dword  fps,
int  cols,
int  rows = 1 
)

Constructor of the Sprite class.

Constructor of the Sprite class, that creates a blank sprite.

Parameters:
w Width of the sprite.
h Height of the sprite.
bpp Depth of color of the sprite.
fps Frames per second of the sprite.
cols Columns of the sprite.
rows Rows of the sprite.
See also:
operator=(), ~Sprite().

Yukino::Sprite::Sprite ( int  w,
int  h,
int  bpp,
dword  fps,
vector< RectAux > &  frames 
)

Constructor of the Sprite class.

Constructor of the Sprite class, that creates a blank sprite.

Parameters:
w Width of the sprite.
h Height of the sprite.
bpp Depth of color of the sprite.
fps Frames per second of the sprite.
frames Specification of the frames.
See also:
operator=(), ~Sprite().

Yukino::Sprite::Sprite ( const string &  file  ) 

Constructor of the Sprite class.

Constructor of the Sprite class, that loads a file.

Parameters:
file Path of the file.
See also:
operator=(), ~Sprite().

Yukino::Sprite::Sprite ( const char *  file  ) 

Constructor of the Sprite class.

Constructor of the Sprite class, that loads a file.

Parameters:
file Path of the file.
See also:
operator=(), ~Sprite().

Yukino::Sprite::Sprite ( const Sprite obj  ) 

Copy constructor of the Sprite class.

Parameters:
obj Sprite object to copy.
See also:
operator=(), ~Sprite().

Yukino::Sprite::~Sprite (  ) 

Destructor of the Sprite class.

See also:
Sprite(), operator=().


Member Function Documentation

UINT Yukino::Sprite::Create ( int  w,
int  h,
int  bpp,
dword  fps,
vector< RectAux > &  frames 
)

Function to create a blank sprite in the Sprite.

This function serves to create a blank sprite in the Sprite.

Parameters:
w Width of the sprite.
h Height of the sprite.
bpp Depth of color of the sprite.
fps Frames per second of the sprite.
frames Specification of the frames.
See also:
Load(), Save(), Free().
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_CREATESURF.

UINT Yukino::Sprite::Create ( int  w,
int  h,
int  bpp,
dword  fps,
int  cols,
int  rows = 1 
)

Function to create a blank sprite in the Sprite.

This function serves to create a blank sprite in the Sprite.

Parameters:
w Width of the image.
h Height of the image.
bpp Depth of color of the image.
fps Frames per second of the sprite.
cols Columns of the sprite.
rows Rows of the sprite.
See also:
Load(), Save(), Free().
Returns:
If everything goes well returns 0, on errors returns: SURFACE_ERROR_CREATESURF.

void Yukino::Sprite::Free ( void   )  [virtual]

Function to release the data of the Sprite object.

This function serves to release the content of the Sprite object.

See also:
Create(), Load(), Save().

Reimplemented from Yukino::Surface.

dword Yukino::Sprite::GetActFrame ( void   )  const [inline]

Function to obtain the actual frame of the animation.

This function serves to obtain the actual frame of the animation.

See also:
SetActFrame().
Returns:
The actual frame.

dword Yukino::Sprite::GetFPS ( void   )  [inline]

Function to obtain the number of frames per second.

This function serves to obtain the speed of the animation.

See also:
SetFPS().
Returns:
The speed of the animation.

void Yukino::Sprite::GetFrame ( word  i,
Rect frame 
) const [inline]

Function to obtain one frame of the animation.

This function serves to obtain one frame of the animation.

Parameters:
i Number of the frame.
frame Properties of the frame.
See also:
SetFrame().

int Yukino::Sprite::GetNumFrames ( void   )  const [inline]

Function to obtain the number of frames of the animation.

This function serves to obtain the number of frames of the animation.

See also:
SetNumFrames().
Returns:
The number of frames.

virtual UINT Yukino::Sprite::Load ( const string &  file  )  [inline, virtual]

Function to load a sprite from a file.

This function serves to load a sprite from a file.

Parameters:
file Path of the file.
See also:
Create(), Save(), Free().
Returns:
If everything goes well returns 0, on errors returns: SPRITE_ERROR_FOPEN, SPRITE_ERROR_READHEADER, SPRITE_ERROR_WRONGFID, SURFACE_ERROR_RWFROMFILE, SURFACE_ERROR_UNKOWNFORMAT, SURFACE_ERROR_LOADINGFILE.

Reimplemented from Yukino::Surface.

UINT Yukino::Sprite::Load ( const char *  file  )  [virtual]

Function to load a sprite from a file.

This function serves to load a sprite from a file.

Parameters:
file Path of the file.
See also:
Create(), Save(), Free().
Returns:
If everything goes well returns 0, on errors returns: SPRITE_ERROR_FOPEN, SPRITE_ERROR_READHEADER, SPRITE_ERROR_WRONGFID, SURFACE_ERROR_RWFROMFILE, SURFACE_ERROR_UNKOWNFORMAT, SURFACE_ERROR_LOADINGFILE.

Reimplemented from Yukino::Surface.

void Yukino::Sprite::NextActFrame ( void   )  [inline]

Function to pass to the next frame of the animation.

This function serves to pass to the next frame of the animation.

See also:
Update().

Sprite & Yukino::Sprite::operator= ( Sprite obj  )  [virtual]

Operator = of the Sprite class.

The obj object is copied in the actual object, and this is given back.

See also:
Sprite(), ~Sprite().

void Yukino::Sprite::ResetTime ( void   )  [inline]

Function to reset the passed time.

This function serves to reset the passed time.

virtual UINT Yukino::Sprite::Save ( const string &  file,
const string &  texture 
) [inline, virtual]

Function to save a sprite in a file.

This function serves to save a sprite in a file.

Parameters:
file Path of the file.
texture Path of the image file.
See also:
Create(), Load(), Free().
Returns:
If everything goes well returns 0, on errors returns: SPRITE_ERROR_FOPEN, SPRITE_ERROR_READHEADER, SURFACE_ERROR_SAVINGFILE.

UINT Yukino::Sprite::Save ( const char *  file,
const char *  texture 
) [virtual]

Function to save a sprite in a file.

This function serves to save a sprite in a file.

Parameters:
file Path of the file.
texture Path of the image file.
See also:
Create(), Load(), Free().
Returns:
If everything goes well returns 0, on errors returns: SPRITE_ERROR_FOPEN, SPRITE_ERROR_READHEADER, SURFACE_ERROR_SAVINGFILE.

void Yukino::Sprite::SetActFrame ( dword  frame  )  [inline]

Function to change the actual frame of the animation.

This function serves to change the actual frame of the animation.

Parameters:
frame Actual frame.
See also:
GetActFrame().

void Yukino::Sprite::SetFPS ( dword  fps  )  [inline]

Function to change the number of frames per second.

This function serves to change the speed of the animation.

Parameters:
fps Frames per second of the sprite.
See also:
GetFPS().

void Yukino::Sprite::SetFrame ( word  i,
const Rect frame 
) [inline]

Function to change one frame of the animation.

This function serves to change one frame of the animation.

Parameters:
i Number of the frame.
frame Properties of the frame.
See also:
GetFrame().

void Yukino::Sprite::SetFrame ( word  i,
sword  x,
sword  y,
word  w,
word  h 
) [inline]

Function to change one frame of the animation.

This function serves to change one frame of the animation.

Parameters:
i Number of the frame.
x Coordinate x of the frame.
y Coordinate y of the frame.
w Width of the frame.
h Height of the frame.
See also:
GetFrame().

void Yukino::Sprite::SetFrames ( vector< RectAux > &  frames  )  [inline]

Function to change the frames of the animation.

This function serves to change the frames of the animation.

Parameters:
frames Frames of the animation.

bool Yukino::Sprite::SetNumFrames ( int  numframes  )  [inline]

Function to change the number of frames of the animation.

This function serves to change the number of frames of the animation.

Parameters:
numframes Number of frames.
See also:
GetNumFrames().

bool Yukino::Sprite::SetNumFrames ( int  cols,
int  rows 
) [inline]

Function to change the number of frames of the animation.

This function serves to change the number of frames of the animation.

Parameters:
cols Columns of the sprite.
rows Rows of the sprite.
See also:
GetNumFrames().

void Yukino::Sprite::Update ( dword  time  )  [inline]

Function to update the actual frame of the animation.

This function serves to update the actual frame of the animation.

Parameters:
time Passed time.
See also:
NextActFrame().


The documentation for this class was generated from the following files:
Generated on Sun Jun 25 03:43:36 2006 for Yukino by  doxygen 1.4.7