SDLGameEngine

SgeSpriteGroup

Sprite groups. More...

Data Structures

struct  SGESPRITEGROUP
 holds a SGEARRAY with all sprites of the group More...

Functions

SGESPRITEGROUPsgeSpriteGroupNew (void)
 creates a new empty spritegroup
void sgeSpriteGroupDestroy (SGESPRITEGROUP *g)
 destroy a spritegroup and free resources
void sgeSpriteGroupAddSprite (SGESPRITEGROUP *g, SGESPRITE *s)
 adds a sprite to the group
int sgeSpriteGroupCollide (SGESPRITEGROUP *g, SGESPRITEGROUP *cg)
 checks if two sprite groups collide anywhere
int sgeSpriteGroupCollideSprite (SGESPRITEGROUP *g, SGESPRITE *s)
 checks if a sprite collides a sprite group
SGESPRITEsgeSpriteGroupGetCollider (SGESPRITEGROUP *g, SGESPRITEGROUP *cg)
 get the first sprite of group g which collides with group cg
SGESPRITEsgeSpriteGroupGetColliderSprite (SGESPRITEGROUP *g, SGESPRITE *s)
 get the first sprite of group g which collides with sprite s
void sgeSpriteGroupDraw (SGESPRITEGROUP *g)
 draw a complete sprite group to the screen
void sgeSpriteGroupDrawRelative (SGESPRITEGROUP *g, int camx, int camy)
 draw a complete sprite group to the screen, relative to a 'camera' position

Detailed Description

Sprite groups.

Functions to handle sprites in groups, for example for group drawing or group colliding.


Function Documentation

void sgeSpriteGroupAddSprite ( SGESPRITEGROUP g,
SGESPRITE s 
)

adds a sprite to the group

Parameters:
gpointer to SGESPRITEGROUP
gpointer to SGESPRITE

Definition at line 29 of file sgespritegroup.c.

int sgeSpriteGroupCollide ( SGESPRITEGROUP g,
SGESPRITEGROUP cg 
)

checks if two sprite groups collide anywhere

Parameters:
gpointer to the first SGESPRITEGROUP
cgpointer to the second SGESPRITEGROUP
Returns:
YES/NO if any sprite of group g collides any sprite of group cg

Definition at line 33 of file sgespritegroup.c.

int sgeSpriteGroupCollideSprite ( SGESPRITEGROUP g,
SGESPRITE s 
)

checks if a sprite collides a sprite group

Parameters:
gpointer to the SGESPRITEGROUP
spointer to the SGESPRITE
Returns:
YES/NO if sprite s collides with any sprite in group g

This is a simple way for example to check of the player collides with any opponent.

Definition at line 38 of file sgespritegroup.c.

void sgeSpriteGroupDestroy ( SGESPRITEGROUP g)

destroy a spritegroup and free resources

Parameters:
gpointer to SGESPRITEGROUP

Definition at line 23 of file sgespritegroup.c.

void sgeSpriteGroupDraw ( SGESPRITEGROUP g)

draw a complete sprite group to the screen

Parameters:
gpointer to the first SGESPRITEGROUP

Definition at line 63 of file sgespritegroup.c.

void sgeSpriteGroupDrawRelative ( SGESPRITEGROUP g,
int  camx,
int  camy 
)

draw a complete sprite group to the screen, relative to a 'camera' position

Parameters:
gpointer to the first SGESPRITEGROUP
camxthe x coordinate of the camera
camythe y coordinate of the camera

Definition at line 72 of file sgespritegroup.c.

SGESPRITE* sgeSpriteGroupGetCollider ( SGESPRITEGROUP g,
SGESPRITEGROUP cg 
)

get the first sprite of group g which collides with group cg

Parameters:
gpointer to the first SGESPRITEGROUP
cgpointer to the second SGESPRITEGROUP
Returns:
a pointer to SGESPRITE from group g which collides group cg, or NULL if there is none

Definition at line 43 of file sgespritegroup.c.

SGESPRITE* sgeSpriteGroupGetColliderSprite ( SGESPRITEGROUP g,
SGESPRITE s 
)

get the first sprite of group g which collides with sprite s

Parameters:
gpointer to the first SGESPRITEGROUP
spointer to the SGESPRITE
Returns:
a pointer to SGESPRITE from group g which collides with sprite s, or NULL if there is none

Definition at line 53 of file sgespritegroup.c.

SGESPRITEGROUP* sgeSpriteGroupNew ( void  )

creates a new empty spritegroup

Returns:
a pointer to SGESPRITEGROUP

Definition at line 11 of file sgespritegroup.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines