SANDAL2
A SDL2 Wrapper in C
Classes | Typedefs | Functions
Sprite.h File Reference

Sprite manager for SANDAL2. More...

#include <stdlib.h>
Include dependency graph for Sprite.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Sprite
 informations about a step of an animation More...
 
struct  ListSprite
 all steps of an animation More...
 
struct  ListAnimation
 a list of animations More...
 

Typedefs

typedef struct Sprite Sprite
 
typedef struct ListSprite ListSprite
 

Functions

ListSpriteinitListSprite (int code)
 create an empty list of sprite More...
 
void freeListSprite (ListSprite *l)
 free the memory of a list of sprite More...
 
int addSprite (ListSprite *l, int x, int y, int width, int height, unsigned lifespan, int code)
 add a Sprite to the list More...
 
int delSprite (ListSprite *l, int code)
 remove a Sprite to the list More...
 
int setLifeSpanSprite (ListSprite *l, int code, unsigned lifespan)
 set the lifespan of a sprite More...
 
int setSprite (ListSprite *l, int code)
 change the current sprite in a given list of sprite More...
 
ListAnimationinitListAnimation ()
 create an empty list of animation More...
 
void freeListAnimation (ListAnimation *l)
 free the memory of a list of animation More...
 
int createAnimation (ListAnimation *l, int code)
 add an empty animation to the list More...
 
int delAnimation (ListAnimation *l, int code)
 remove an empty animation from the list More...
 
int addSpriteAnimation (ListAnimation *l, int code, int x, int y, int width, int height, unsigned lifespan, int codeS)
 add a Sprite to an animation More...
 
int delSpriteAnimation (ListAnimation *l, int code, int codeS)
 remove a Sprite to an animation More...
 
int setLifeSpanSpriteAnimation (ListAnimation *l, int code, int codeS, unsigned lifespan)
 set the lifespan of a sprite More...
 
int setAnimation (ListAnimation *l, int code)
 set the current animation of a list of animations More...
 
int setSpriteAnimation (ListAnimation *l, int codeS)
 change the current sprite in the current list of sprite in a given list of animation More...
 

Detailed Description

Sprite manager for SANDAL2.

Author
Baptiste PRUNIER (KLEVH)

Function Documentation

◆ addSprite()

int addSprite ( ListSprite l,
int  x,
int  y,
int  width,
int  height,
unsigned  lifespan,
int  code 
)

add a Sprite to the list

Parameters
l: list of sprite
x: abscissa coordinate of the top left corner of the sprite in its image
y: ordinate coordinate of the top left corner of the sprite in its image
width: width of the sprite in its image
height: height of the sprite in its image
lifespan: number of time the sprite should be displaied before going to the next sprite
code: identifier of the Sprite to add
Returns
0 if the sprite was correctly added, 1 if not

◆ addSpriteAnimation()

int addSpriteAnimation ( ListAnimation l,
int  code,
int  x,
int  y,
int  width,
int  height,
unsigned  lifespan,
int  codeS 
)

add a Sprite to an animation

Parameters
l: list of animations
code: code of the animation to add the sprite
x: abscissa coordinate of the top left corner of the sprite in its image
y: ordinate coordinate of the top left corner of the sprite in its image
width: width of the sprite in its image
height: height of the sprite in its image
lifespan: number of time the sprite should be displaied before going to the next sprite
codeS: code of the Sprite to be added
Returns
0 if the sprite was correctly added, 1 if not

◆ createAnimation()

int createAnimation ( ListAnimation l,
int  code 
)

add an empty animation to the list

Parameters
l: list of animation
code: code of the new animation
Returns
0 if the animation could be added, 1 if not

◆ delAnimation()

int delAnimation ( ListAnimation l,
int  code 
)

remove an empty animation from the list

Parameters
l: list of animation
code: code of the animation to be removed
Returns
0 if the animation could be removed, 1 if not

◆ delSprite()

int delSprite ( ListSprite l,
int  code 
)

remove a Sprite to the list

Parameters
l: list of sprite
code: code of the sprite to be removed
Returns
0 if the sprite was correctly removed, 1 if not

◆ delSpriteAnimation()

int delSpriteAnimation ( ListAnimation l,
int  code,
int  codeS 
)

remove a Sprite to an animation

Parameters
l: list of animations
code: code of the animation to remove the sprite
codeS: code of the sprite to be removed
Returns
0 if the sprite was correctly removed, 1 if not

◆ freeListAnimation()

void freeListAnimation ( ListAnimation l)

free the memory of a list of animation

Parameters
l: list to be freed

◆ freeListSprite()

void freeListSprite ( ListSprite l)

free the memory of a list of sprite

Parameters
l: list to be freed

◆ initListAnimation()

ListAnimation* initListAnimation ( )

create an empty list of animation

Returns
the empty list of animation

◆ initListSprite()

ListSprite* initListSprite ( int  code)

create an empty list of sprite

Returns
the empty list of sprite

◆ setAnimation()

int setAnimation ( ListAnimation l,
int  code 
)

set the current animation of a list of animations

Parameters
l: list of animations
code: code of the animation to be set as current
Returns
0 if the animation could be set as current, 1 if not

◆ setLifeSpanSprite()

int setLifeSpanSprite ( ListSprite l,
int  code,
unsigned  lifespan 
)

set the lifespan of a sprite

Parameters
l: list of sprite
code: code of the sprite to be changed
lifespan: new number of time the sprite should be displaied before going to the next sprite
Returns
0 if the lifespan could be set, 1 if not

◆ setLifeSpanSpriteAnimation()

int setLifeSpanSpriteAnimation ( ListAnimation l,
int  code,
int  codeS,
unsigned  lifespan 
)

set the lifespan of a sprite

Parameters
l: list of animations
code: code of the animation to set the sprite
codeS: code of the sprite to be modified
lifespan: new number of time the sprite should be displaied before going to the next sprite
Returns
0 if the lifespan could be set, 1 if not

◆ setSprite()

int setSprite ( ListSprite l,
int  code 
)

change the current sprite in a given list of sprite

Parameters
l: list of sprite
code: code of the sprite to be set
Returns
0 if the sprite could be set, 1 if not

◆ setSpriteAnimation()

int setSpriteAnimation ( ListAnimation l,
int  codeS 
)

change the current sprite in the current list of sprite in a given list of animation

Parameters
l: list of animation
codeS: code of the sprite to be set
Returns
0 if the sprite could be set, 1 if not