diff options
author | chai <chaifix@163.com> | 2018-11-18 22:32:55 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-11-18 22:32:55 +0800 |
commit | fc7b4579e49aaeecc81919e247e03f68bd5abfd4 (patch) | |
tree | 6547b8c7d3632591358267d06006eddc53216105 /src/libjin/Graphics/particles/je_particle_system.h | |
parent | 3905924fc35f92e5092576c3f6e8fc5db7588cde (diff) |
*粒子系统
Diffstat (limited to 'src/libjin/Graphics/particles/je_particle_system.h')
-rw-r--r-- | src/libjin/Graphics/particles/je_particle_system.h | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/libjin/Graphics/particles/je_particle_system.h b/src/libjin/Graphics/particles/je_particle_system.h index afa96b2..8ee79ec 100644 --- a/src/libjin/Graphics/particles/je_particle_system.h +++ b/src/libjin/Graphics/particles/je_particle_system.h @@ -22,10 +22,10 @@ namespace JinEngine /// /// Definition of particle system. /// - struct ParticleSystemDef : public Temporary + struct ParticleSystemDef { + ParticleSystemDef() {} uint maxParticleCount = 1; ///< Max count of particles in pool. 1 by default. - ParticleEmitterDef emitterDef; ///< Particle emitter definition. ParticleDef particleDef; ///< Particle definition. }; @@ -33,7 +33,7 @@ namespace JinEngine /// /// Particle emitter, handle all particles it emitts. /// - class ParticleSystem : public Game::GameObject + class ParticleSystem/* : public Game::GameObject*/ { public: /// @@ -51,25 +51,37 @@ namespace JinEngine /// /// Update particle system and all alive particles. /// - void update(float sec); + void update(float dt); /// /// Render particle system. /// - void render(int x, int y, float sx = 1, float sy = 1, float r = 0, float ax = 0, float ay = 0); + void render(float x, float y, float sx = 1, float sy = 1, float r = 0, float ax = 0, float ay = 0); /// /// Set sprite to render. /// /// @param sprite Sprite to render. /// - void setSprite(Sprite* sprite); + void setGraphic(const Graphic* graphic); private: - // Disable default constructor. + + friend class ParticleEmitter; + ParticleSystem(); /// + /// + /// + Particle* claim(); + + /// + /// + /// + void recycle(int i, Particle* p); + + /// /// Particle system definition. /// ParticleSystemDef mDef; @@ -77,7 +89,7 @@ namespace JinEngine /// /// Sprite to be drawn. /// - Sprite* mSprite; + const Graphic* mGraphic; /// /// Particle emitter. |