libcucul sprite handling


Functions

cucul_sprite_tcucul_load_sprite (char const *)
 Allocate a sprite loaded from a file.
int cucul_get_sprite_frames (cucul_sprite_t const *)
 Return the number of frames in a sprite.
int cucul_get_sprite_width (cucul_sprite_t const *, int)
 Return the width of a sprite.
int cucul_get_sprite_height (cucul_sprite_t const *, int)
 Return the height of a sprite.
int cucul_get_sprite_dx (cucul_sprite_t const *, int)
 Return the X coordinate of a sprite's handle.
int cucul_get_sprite_dy (cucul_sprite_t const *, int)
 Return the Y coordinate of a sprite's handle.
void cucul_draw_sprite (cucul_canvas_t *, int, int, cucul_sprite_t const *, int)
 Draw a sprite's specific frame at the given coordinates. If the frame does not exist, nothing is displayed.
void cucul_free_sprite (cucul_sprite_t *)
 Free the memory associated with a sprite.

Detailed Description

These functions provide high level routines for sprite loading, animation and rendering.

Function Documentation

cucul_sprite_t* cucul_load_sprite char const *  file  ) 
 

Parameters:
file The filename.
Returns:
The sprite, or NULL if an error occured.

int cucul_get_sprite_frames cucul_sprite_t const *  sprite  ) 
 

Parameters:
sprite The sprite.
Returns:
The number of frames.

int cucul_get_sprite_width cucul_sprite_t const *  sprite,
int  f
 

Parameters:
sprite The sprite.
f The frame index.
Returns:
The width of the given frame of the sprite.

int cucul_get_sprite_height cucul_sprite_t const *  sprite,
int  f
 

Parameters:
sprite The sprite.
f The frame index.
Returns:
The height of the given frame of the sprite.

int cucul_get_sprite_dx cucul_sprite_t const *  sprite,
int  f
 

Parameters:
sprite The sprite.
f The frame index.
Returns:
The X coordinate of the given frame's handle.

int cucul_get_sprite_dy cucul_sprite_t const *  sprite,
int  f
 

Parameters:
sprite The sprite.
f The frame index.
Returns:
The Y coordinate of the given frame's handle.

void cucul_draw_sprite cucul_canvas_t cv,
int  x,
int  y,
cucul_sprite_t const *  sprite,
int  f
 

Parameters:
cv A libcucul canvas
x The X coordinate.
y The Y coordinate.
sprite The sprite.
f The frame index.
Returns:
void

void cucul_free_sprite cucul_sprite_t sprite  ) 
 

Parameters:
sprite The sprite to be freed.
Returns:
void