Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
ParticleEmitterComponent.hpp
1 // Copyright (C) 2017 Jérôme Leclercq
2 // This file is part of the "Nazara Development Kit"
3 // For conditions of distribution and use, see copyright notice in Prerequesites.hpp
4 
5 #pragma once
6 
7 #ifndef NDK_SERVER
8 #ifndef NDK_COMPONENTS_PARTICLEEMITTERCOMPONENT_HPP
9 #define NDK_COMPONENTS_PARTICLEEMITTERCOMPONENT_HPP
10 
11 #include <Nazara/Graphics/ParticleEmitter.hpp>
12 #include <NDK/Component.hpp>
13 
14 namespace Ndk
15 {
16  class NDK_API ParticleEmitterComponent : public Component<ParticleEmitterComponent>, public Nz::ParticleEmitter
17  {
18  public:
19  using SetupFunc = std::function<void(const EntityHandle& /*entity*/, Nz::ParticleMapper& /*mapper*/, unsigned int /*count*/)>;
20 
21  inline ParticleEmitterComponent();
22  ParticleEmitterComponent(const ParticleEmitterComponent& emitter) = default;
24  ~ParticleEmitterComponent() = default;
25 
26  inline void Enable(bool active = true);
27 
28  inline bool IsActive() const;
29 
30  inline void SetSetupFunc(SetupFunc func);
31 
32  static ComponentIndex componentIndex;
33 
34  private:
35  void SetupParticles(Nz::ParticleMapper& mapper, unsigned int count) const override;
36 
37  SetupFunc m_setupFunc;
38  bool m_isActive;
39  };
40 }
41 
42 #include <NDK/Components/ParticleEmitterComponent.inl>
43 
44 #endif // NDK_COMPONENTS_PARTICLEEMITTERCOMPONENT_HPP
45 #endif // NDK_SERVER
TODO: For now is unable to display different color in the history, it needs a RichTextDrawer to do so...
Definition: Algorithm.hpp:12
Graphics class that represents the mapping between the internal buffer and the particle declaration...
Definition: ParticleMapper.hpp:17
NDK class that represents the component emitter of particles.
Definition: ParticleEmitterComponent.hpp:16
Graphics class that represents an emitter of particles.
Definition: ParticleEmitter.hpp:19