| 1 | /*! |
|---|
| 2 | \file particle_engine.h |
|---|
| 3 | \brief Definition of the ParticleEngine |
|---|
| 4 | */ |
|---|
| 5 | |
|---|
| 6 | #ifndef _PARTICLE_ENGINE_H |
|---|
| 7 | #define _PARTICLE_ENGINE_H |
|---|
| 8 | |
|---|
| 9 | #include "base_object.h" |
|---|
| 10 | #include "particle_system.h" |
|---|
| 11 | #include "particle_emitter.h" |
|---|
| 12 | |
|---|
| 13 | // FORWARD DEFINITION |
|---|
| 14 | template<class T> class tList; |
|---|
| 15 | class ParticleSystem; |
|---|
| 16 | class ParticleEmitter; |
|---|
| 17 | |
|---|
| 18 | struct ParticleConnection |
|---|
| 19 | { |
|---|
| 20 | ParticleEmitter* emitter; //!< The emitter to emit system from. |
|---|
| 21 | ParticleSystem* system; //!< The Particles emitted from emitter. |
|---|
| 22 | }; |
|---|
| 23 | |
|---|
| 24 | //! A default singleton class. |
|---|
| 25 | class ParticleEngine : public BaseObject { |
|---|
| 26 | |
|---|
| 27 | public: |
|---|
| 28 | static ParticleEngine* getInstance(void); |
|---|
| 29 | virtual ~ParticleEngine(void); |
|---|
| 30 | |
|---|
| 31 | void tick(float dt); |
|---|
| 32 | void draw(float dt); |
|---|
| 33 | |
|---|
| 34 | void addSystem(ParticleSystem* system); |
|---|
| 35 | void addEmitter(ParticleEmitter* emitter); |
|---|
| 36 | void addConnection(ParticleEmitter* emitter, ParticleSystem* system); |
|---|
| 37 | |
|---|
| 38 | bool removeSystem(ParticleSystem* system); |
|---|
| 39 | bool removeEmitter(ParticleEmitter* emitter); |
|---|
| 40 | bool breakConnection(ParticleEmitter* emitter, ParticleSystem* system); |
|---|
| 41 | bool breakConnection(ParticleConnection* connection); |
|---|
| 42 | |
|---|
| 43 | void debug(); |
|---|
| 44 | |
|---|
| 45 | private: |
|---|
| 46 | ParticleEngine(void); |
|---|
| 47 | static ParticleEngine* singletonRef; |
|---|
| 48 | |
|---|
| 49 | tList<ParticleSystem>* systemList; |
|---|
| 50 | tList<ParticleEmitter>* emitterList; |
|---|
| 51 | |
|---|
| 52 | tList<ParticleConnection>* connectionList; |
|---|
| 53 | }; |
|---|
| 54 | |
|---|
| 55 | #endif /* _PARTICLE_ENGINE_H */ |
|---|