SDLGameEngine

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

Data Structures | Functions

# SgeSpriteGroup

Sprite groups. More...

## Data Structures
struct | SGESPRITEGROUP
| holds a SGEARRAY with all sprites of the group More...
## Functions
SGESPRITEGROUP * | sgeSpriteGroupNew (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
SGESPRITE * | sgeSpriteGroupGetCollider (SGESPRITEGROUP *g, SGESPRITEGROUP *cg)
| get the first sprite of group g which collides with group cg
SGESPRITE * | sgeSpriteGroupGetColliderSprite (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:

  g | pointer to SGESPRITEGROUP
  g | pointer to SGESPRITE

Definition at line 29 of file sgespritegroup.c.

int sgeSpriteGroupCollide | ( | SGESPRITEGROUP * | g,
|  | SGESPRITEGROUP * | cg
| ) |  |

checks if two sprite groups collide anywhere

Parameters:

  g | pointer to the first SGESPRITEGROUP
  cg | pointer 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:

  g | pointer to the SGESPRITEGROUP
  s | pointer 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:

  g | pointer to SGESPRITEGROUP

Definition at line 23 of file sgespritegroup.c.

void sgeSpriteGroupDraw | ( | SGESPRITEGROUP * | g | ) |

draw a complete sprite group to the screen

Parameters:

  g | pointer 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:

  g | pointer to the first SGESPRITEGROUP
  camx | the x coordinate of the camera
  camy | the 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:

  g | pointer to the first SGESPRITEGROUP
  cg | pointer 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:

  g | pointer to the first SGESPRITEGROUP
  s | pointer 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