SDLGameEngine

include/sgeparticles.h

Go to the documentation of this file.
00001 #ifndef _SGEPARTICLES_H
00002 #define _SGEPARTICLES_H
00003 
00004 #ifdef __cplusplus
00005 extern "C" {
00006 #endif
00007 
00012 /*
00013  * Copyright (c) 2007 Heiko Irrgang
00014  *
00015  * The license and distribution terms for this file may be
00016  * found in the file COPYING in this distribution or at
00017  * http://93-interactive.com/cms/products/software/sdl-game-engine/license/
00018  */
00019 
00044 typedef struct {
00046         Uint32 timeToLive;
00047         float speed;
00048         float angle;
00049         float x,y;
00050         float gravity;
00051         Uint32 color;
00052 } SGEPIXELPARTICLE;
00053 
00057 typedef struct {
00059         Uint8 r1,g1,b1;
00060         Uint8 r2,g2,b2;
00061 } SGEPIXELPARTICLEDATA;
00062 
00066 typedef struct {
00068         Uint32 timeToLive;
00069         float speed;
00070         float angle;
00071         float x,y;
00072         float gravity;
00073 } SGESPRITEPARTICLE;
00074 
00078 typedef struct {
00080         SGESPRITE *sprite;
00081 } SGESPRITEPARTICLEDATA;
00082 
00087 typedef struct {
00089         SDL_Surface *drawSurface;
00090 
00092         Uint32 runtime;
00093 
00095         SGEARRAY *particles;
00096 
00098         Uint32 infinite;
00099 
00101         Uint32 x;
00102 
00104         Uint32 y;
00105 
00107         Uint32 timeToLive;
00108 
00110         Uint32 timeToLiveDistribution;
00111 
00113         float emission;
00114 
00116         float emissionDistribution;
00117 
00119         float speed;
00120 
00122         float speedDistribution;
00123 
00125         float angle;
00126 
00128         float angleDistribution;
00129 
00131         float gravity;
00132 
00134         void *custom;
00135         void (*customDestroy)(void *);
00136         Uint32 (*draw)(Uint32, void *);
00137         void *(*create)(void *);
00138         float internalEmission;
00139 } SGEPARTICLES;
00140 
00155 SGEPARTICLES *sgeParticlesPixelNew(Uint8 r1, Uint8 g1, Uint8 b1, Uint8 r2, Uint8 g2, Uint8 b2);
00156 
00163 SGEPARTICLES *sgeParticlesSpriteNew(SGESPRITE *sprite);
00164 
00169 void sgeParticlesDestroy(SGEPARTICLES *p);
00170 
00175 void sgeParticlesDraw(SGEPARTICLES *p);
00176 
00178 float sgeParticlesGetNewEmission(SGEPARTICLES *p);
00179 Uint32 sgeParticlesGetNewTimeToLive(SGEPARTICLES *p);
00180 float sgeParticlesGetNewSpeed(SGEPARTICLES *p);
00181 float sgeParticlesGetNewAngle(SGEPARTICLES *p);
00182 float sgeParticlesGetNewX(float x, float angle, float speed);
00183 float sgeParticlesGetNewY(float y, float angle, float speed, float gravity);
00184 
00185 void *sgePixelParticleNew(void *p);
00186 void sgePixelParticleDestroy(Uint32 arrayidx, void *particle);
00187 Uint32 sgePixelParticleDraw(Uint32 arrayidx, void *p);
00188 void sgeParticlesPixelCustomDestroy(void *data);
00189 
00190 void *sgeSpriteParticleNew(void *p);
00191 void sgeSpriteParticleDestroy(Uint32 arrayidx, void *particle);
00192 Uint32 sgeSpriteParticleDraw(Uint32 arrayidx, void *p);
00193 void sgeParticlesSpriteCustomDestroy(void *data);
00194 
00195 SGEPARTICLES *sgeParticlesNew(
00196                 void *(*createFunction)(void *),
00197                 Uint32 (*drawFunction)(Uint32, void *),
00198                 void (*freeFunction)(Uint32, void *)
00199 );
00200 
00201 // }@
00202 
00203 #ifdef __cplusplus
00204 }
00205 #endif
00206 
00207 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines