SDLGameEngine

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

Data Structures | Functions | Variables

# SgeParticles

Particle system. More...

## Data Structures
struct | SGEPIXELPARTICLE
| internal, holds information of a pixel particle More...
struct | SGEPIXELPARTICLEDATA
| internal, holds color information of a pixel particle More...
struct | SGESPRITEPARTICLE
| internal, holds information of a sprite particle More...
struct | SGESPRITEPARTICLEDATA
| internal, holds image representation of a sprite particle More...
struct | SGEPARTICLES
| a structure holding necessary information about a particle emitter and providing a lot of variables for configuration More...
## Functions
SGEPARTICLES * | sgeParticlesPixelNew (Uint8 r1, Uint8 g1, Uint8 b1, Uint8 r2, Uint8 g2, Uint8 b2)
| create a new pixel emitter
SGEPARTICLES * | sgeParticlesSpriteNew (SGESPRITE *sprite)
| create a new sprite particle emitter
void | sgeParticlesDestroy (SGEPARTICLES *p)
| destroy a SGEPARTICLES structure and free its resources
void | sgeParticlesDraw (SGEPARTICLES *p)
| draw the particles on the destination surface
## Variables
Uint32 | SGEPARTICLES::runtime
| the runtime of the particles emitter in frames
SGEARRAY * | SGEPARTICLES::particles
| a SGEARRAY holding the particles
Uint32 | SGEPARTICLES::infinite
| YES/NO if the particles should live forever, defaults to NO.
Uint32 | SGEPARTICLES::x
| the emitters x coordinate
Uint32 | SGEPARTICLES::y
| the emitters y coordinate
Uint32 | SGEPARTICLES::timeToLive
| the time to live for particles in frames
Uint32 | SGEPARTICLES::timeToLiveDistribution
| a range the timeToLive will vary, it is +/-, so timeToLive=100 and timeToLiveDistribution=50 will give values of 100-25 to 100+25, so 75 to 125
float | SGEPARTICLES::emission
| the number of particles created per frame as float, so values of less then 1 are possible
float | SGEPARTICLES::emissionDistribution
| the +/- range of the emission
float | SGEPARTICLES::speed
| the speed of the particles
float | SGEPARTICLES::speedDistribution
| the +/- range of the particle speed
float | SGEPARTICLES::angle
| the angle at which particles are fired at in degrees
float | SGEPARTICLES::angleDistribution
| the +/- range of the angle in degrees
float | SGEPARTICLES::gravity
| the gravity pixels are influenced by along the y axis

## Detailed Description

Particle system.

There are currently two types of particle systems: Pixel particles, which are repesented by a single pixel on screen and allow a color variation, and sprite particles, which are represented by a SGESPRITE

After creating the particle emitter, you have a number of configuration options, most of them allow you to specify a ...Distribution.

This value allows you to specify a +/- range of the values. For example, if you have a emitters angle set to 90 degrees, and its angleDistribution to 60 degrees, particles emit in a random range of 90-30 to 90+30, so a random range of 60 to 120 degrees.

## Function Documentation

void sgeParticlesDestroy | ( | SGEPARTICLES * | p | ) |

destroy a SGEPARTICLES structure and free its resources

Parameters:

  p | a pointer to SGEPARTICLES

Definition at line 41 of file sgeparticles.c.

void sgeParticlesDraw | ( | SGEPARTICLES * | p | ) |

draw the particles on the destination surface

Parameters:

  p | a pointer to SGEPARTICLES

Definition at line 49 of file sgeparticles.c.

SGEPARTICLES* sgeParticlesPixelNew | ( | Uint8 | r1,
|  | Uint8 | g1,
|  | Uint8 | b1,
|  | Uint8 | r2,
|  | Uint8 | g2,
|  | Uint8 | b2
| ) |  |

create a new pixel emitter

Parameters:

  r1 | the red value of the first color
  g1 | the green value of the first color
  b1 | the blue value of the first color
  r2 | the red value of the second color
  g2 | the green value of the second color
  b2 | the blue value of the second color

Returns:
  a pointer to SGEPARTICLES

See also:
  SGEPARTICLES

The two colors specify a range of colors within the created pixel particles are.

Definition at line 158 of file sgeparticles.c.

SGEPARTICLES* sgeParticlesSpriteNew | ( | SGESPRITE * | sprite | ) |

create a new sprite particle emitter

Parameters:

  a | pointer to SGESPRITE which is used as particle image

Returns:
  a pointer to SGEPARTICLES

See also:
  SGEPARTICLES

Definition at line 177 of file sgeparticles.c.

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines