CL_SpriteDescription Class Reference
[clanDisplay 2D]

This class contains everything to construct a sprite - its data, default settings etc. More...

#include <sprite_description.h>

List of all members.

Public Member Functions

Construction

 CL_SpriteDescription ()
 Constructs a sprite description.
 CL_SpriteDescription (CL_GraphicContext &gc, const CL_StringRef &resource_id, CL_ResourceManager *resources, const CL_ImageImportDescription &import_desc=CL_ImageImportDescription())
 Constructs a SpriteDescription.
 CL_SpriteDescription (const CL_SpriteDescription &copy)
 Constructs a SpriteDescription.
 ~CL_SpriteDescription ()
Attributes

const std::vector
< CL_SpriteDescriptionFrame > & 
get_frames () const
 Returns a list over all available frames.
Operations

CL_SpriteDescriptionoperator= (const CL_SpriteDescription &copy)
 Copy assignment operator.
void add_frame (const CL_PixelBuffer &pixelbuffer)
 Adds a single image.
void add_frame (const CL_Texture &texture)
 Add frame.
void add_frame (const CL_StringRef &fullname, const CL_ImageImportDescription &import_desc=CL_ImageImportDescription())
 Add frame.
void add_frame (CL_IODevice &file, const CL_String &image_type, const CL_ImageImportDescription &import_desc=CL_ImageImportDescription())
 Add frame.
void add_frame (const CL_StringRef &filename, CL_VirtualDirectory &dir, const CL_ImageImportDescription &import_desc=CL_ImageImportDescription())
 Add frame.
void add_frames (const CL_Texture &texture, CL_Rect *frames, int num_frames)
 Add frames.
void add_gridclipped_frames (const CL_PixelBuffer &pixelbuffer, int xpos, int ypos, int width, int height, int xarray=1, int yarray=1, int array_skipframes=0, int xspacing=0, int yspacing=0)
 Adds images formed in a grid.
void add_gridclipped_frames (const CL_Texture &texture, int xpos, int ypos, int width, int height, int xarray=1, int yarray=1, int array_skipframes=0, int xspacing=0, int yspacing=0)
void add_alphaclipped_frames (const CL_PixelBuffer &pixelbuffer, int xpos=0, int ypos=0, double trans_limit=0.05f)
 Adds images separated with pure alpha (within trans_limit).
void add_alphaclipped_frames (const CL_Texture &texture, int xpos=0, int ypos=0, double trans_limit=0.05f)
void add_alphaclipped_frames_free (const CL_PixelBuffer &pixelbuffer, int xpos=0, int ypos=0, double trans_limit=0.05f)
 Adds images separated with pure alpha (within trans_limit).
void add_alphaclipped_frames_free (const CL_Texture &texture, int xpos=0, int ypos=0, double trans_limit=0.05f)
void set_frame_delay (int frame, double delay)
 Sets the duration this frame is displayed, in seconds.

Detailed Description

This class contains everything to construct a sprite - its data, default settings etc.

CL_SpriteDescription is used by CL_Sprite to construct itself based on the description. The description class give a big flexibility creating a sprite, individual frames can come from different image sources, or be cut out from an image source using various different techniques.


Constructor & Destructor Documentation

CL_SpriteDescription::CL_SpriteDescription (  ) 

Constructs a sprite description.

Parameters:
resource_id Resource name of a sprite description resource.
resources Resource manager used to load resource.
CL_SpriteDescription::CL_SpriteDescription ( CL_GraphicContext gc,
const CL_StringRef resource_id,
CL_ResourceManager resources,
const CL_ImageImportDescription import_desc = CL_ImageImportDescription() 
)

Constructs a SpriteDescription.

Parameters:
gc = Graphic Context
resource_id = String Ref
resources = Resource Manager
CL_SpriteDescription::CL_SpriteDescription ( const CL_SpriteDescription copy  ) 

Constructs a SpriteDescription.

Parameters:
copy = Sprite Description
CL_SpriteDescription::~CL_SpriteDescription (  ) 

Member Function Documentation

void CL_SpriteDescription::add_alphaclipped_frames ( const CL_PixelBuffer pixelbuffer,
int  xpos = 0,
int  ypos = 0,
double  trans_limit = 0.05f 
)

Adds images separated with pure alpha (within trans_limit).

The alpha clipper will cut out frames from an image based on the transparency in the picture. It first determines the height of a row by searching for the first line that it considers completely transparent. Then it finds the width of each frame on this line by looking for columns that are completely transparency.

Parameters:
pixelbuffer Image source.
texture Image source.
xpos,ypos Upper left position where alpha cutting should begin.
trans_limit Amount of non-transparent alpha allowed before a pixel is not considered transparent.
void CL_SpriteDescription::add_alphaclipped_frames ( const CL_Texture texture,
int  xpos = 0,
int  ypos = 0,
double  trans_limit = 0.05f 
)
void CL_SpriteDescription::add_alphaclipped_frames_free ( const CL_PixelBuffer pixelbuffer,
int  xpos = 0,
int  ypos = 0,
double  trans_limit = 0.05f 
)

Adds images separated with pure alpha (within trans_limit).

The alpha clipper will cut out frames from an image based on the transparency in the picture. It scans the lines horizontally from top to bottom. As soon as a non-transarent pixel is discovered, the clipper finds the bounding box for that region and then moves on.

Parameters:
pixelbuffer Image source.
texture Image source.
xpos,ypos Upper left position where alpha cutting should begin.
trans_limit Amount of non-transparent alpha allowed before a pixel is not considered transparent.
void CL_SpriteDescription::add_alphaclipped_frames_free ( const CL_Texture texture,
int  xpos = 0,
int  ypos = 0,
double  trans_limit = 0.05f 
)
void CL_SpriteDescription::add_frame ( const CL_PixelBuffer pixelbuffer  ) 

Adds a single image.

Parameters:
pixelbuffer Image source.
filename Filename of image.
vfs Virtual File System to load image from.
void CL_SpriteDescription::add_frame ( const CL_Texture texture  ) 

Add frame.

Parameters:
texture = Texture
void CL_SpriteDescription::add_frame ( const CL_StringRef fullname,
const CL_ImageImportDescription import_desc = CL_ImageImportDescription() 
)

Add frame.

Parameters:
fullname = String Ref
void CL_SpriteDescription::add_frame ( CL_IODevice file,
const CL_String image_type,
const CL_ImageImportDescription import_desc = CL_ImageImportDescription() 
)

Add frame.

Parameters:
file = IODevice
image_type = String
void CL_SpriteDescription::add_frame ( const CL_StringRef filename,
CL_VirtualDirectory dir,
const CL_ImageImportDescription import_desc = CL_ImageImportDescription() 
)

Add frame.

Parameters:
filename = String Ref
dir = Virtual Directory
void CL_SpriteDescription::add_frames ( const CL_Texture texture,
CL_Rect frames,
int  num_frames 
)

Add frames.

Parameters:
texture = Texture
frames = Rect
num_frames = value
void CL_SpriteDescription::add_gridclipped_frames ( const CL_PixelBuffer pixelbuffer,
int  xpos,
int  ypos,
int  width,
int  height,
int  xarray = 1,
int  yarray = 1,
int  array_skipframes = 0,
int  xspacing = 0,
int  yspacing = 0 
)

Adds images formed in a grid.

This function will cut out a grid of frames from one image.

Parameters:
pixelbuffer Image source.
texture Image source.
xpos,ypos Position of where image grid starts.
width,height Size of a frame in the grid.
xarray,yarray Number of columns and rows in grid.
array_skipframes Number of frames to skip at last gridline.
xspacing,yspacing Pixel interspacing between grid frames.
void CL_SpriteDescription::add_gridclipped_frames ( const CL_Texture texture,
int  xpos,
int  ypos,
int  width,
int  height,
int  xarray = 1,
int  yarray = 1,
int  array_skipframes = 0,
int  xspacing = 0,
int  yspacing = 0 
)
const std::vector<CL_SpriteDescriptionFrame>& CL_SpriteDescription::get_frames (  )  const

Returns a list over all available frames.

CL_SpriteDescription& CL_SpriteDescription::operator= ( const CL_SpriteDescription copy  ) 

Copy assignment operator.

void CL_SpriteDescription::set_frame_delay ( int  frame,
double  delay 
)

Sets the duration this frame is displayed, in seconds.


The documentation for this class was generated from the following file: