123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- #ifndef __Particle_ENGINE__
- #define __Particle_ENGINE__
- class PongApp;
- class ParticleEngine;
- class Particle;
- class ParticleType {
- public:
- ParticleType( unsigned int textureID );
- virtual ~ParticleType();
-
- int m_angle;
- int m_angleRandom;
-
- int m_angleInc;
- int m_angleIncRandom;
-
- int m_size;
- int m_sizeRandom;
-
- int m_sizeInc;
- int m_sizeIncRandom;
-
- int m_lifeTime;
- int m_lifeTimeRandom;
-
- int m_fraction;
-
- int m_gravity;
-
- int m_angleIncInc;
-
- int m_sizeIncInc;
-
- unsigned int textureID;
-
- void setVisibility( float fadeInTime,
- float fadeOutTime,
- float generalVisibility );
- float m_fadeOutTimeSecs;
- float m_fadeInTimeSecs;
- float m_generalVisibility;
- bool m_additiveParticle;
- void setColors( float r, float g, float b,
- float rr, float gr, float br );
- float col[3];
- float col_random[3];
- };
- class Particle {
- public:
- Particle();
- ~Particle();
- void run( ParticleEngine *engine, int *fixedGravity, int fixedFrameTime );
- int m_pos[3];
- int m_dir[3];
- int m_lifeTime;
- int m_aliveCounter;
- int m_angle;
- int m_angleInc;
- int m_size;
- int m_sizeInc;
- unsigned int color;
- ParticleType *m_type;
- };
- class ParticleEngine {
- public:
- ParticleEngine(int maxParticles );
- virtual ~ParticleEngine();
- void run( float frameTime );
- void setGravity( float *gravityVector ) {
- m_gravity[0] = (int)( gravityVector[0] * 65536.0f );
- m_gravity[1] = (int)( gravityVector[1] * 65536.0f );
- m_gravity[2] = (int)( gravityVector[2] * 65536.0f );
- };
- void render( SpriteBatch *batch, ParticleType *renderType );
-
- void emitParticles( int count,
- ParticleType *type,
- float *pos, float posRandom,
- float *dir, float dirRandom );
- protected:
- int m_gravity[3];
- Particle *m_particles;
- int m_maxParticles;
- int m_currentParticle;
- };
- #endif
|