ParticleEmitter2.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: ParticleEmitter2.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: Abstract base class for 2-D particle emitter.
6 > Created Time: 2017/05/10
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_PARTICLE_EMITTER2_H
10 #define CUBBYFLOW_PARTICLE_EMITTER2_H
11 
13 
14 namespace CubbyFlow
15 {
20  {
21  public:
28  using OnBeginUpdateCallback = std::function<void(ParticleEmitter2*, double, double)>;
29 
32 
34  virtual ~ParticleEmitter2();
35 
38  void Update(double currentTimeInSeconds, double timeIntervalInSeconds);
39 
41  const ParticleSystemData2Ptr& GetTarget() const;
42 
44  void SetTarget(const ParticleSystemData2Ptr& particles);
45 
56  void SetOnBeginUpdateCallback(const OnBeginUpdateCallback& callback);
57 
58  protected:
60  virtual void OnSetTarget(const ParticleSystemData2Ptr& particles);
61 
63  virtual void OnUpdate(double currentTimeInSeconds, double timeIntervalInSeconds) = 0;
64 
65  private:
66  ParticleSystemData2Ptr m_particles;
67  OnBeginUpdateCallback m_onBeginUpdateCallback;
68  };
69 
71  using ParticleEmitter2Ptr = std::shared_ptr<ParticleEmitter2>;
72 }
73 
74 #endif
void SetOnBeginUpdateCallback(const OnBeginUpdateCallback &callback)
Sets the callback function to be called when ParticleEmitter2::Update function is invoked...
std::shared_ptr< ParticleEmitter2 > ParticleEmitter2Ptr
Shared pointer for the ParticleEmitter2 type.
Definition: ParticleEmitter2.h:71
void SetTarget(const ParticleSystemData2Ptr &particles)
Sets the target particle system to emit.
virtual void OnSetTarget(const ParticleSystemData2Ptr &particles)
Called when ParticleEmitter2::SetTarget is executed.
std::shared_ptr< ParticleSystemData2 > ParticleSystemData2Ptr
Shared pointer type of ParticleSystemData2.
Definition: ParticleSystemData2.h:250
Definition: pybind11Utils.h:24
const ParticleSystemData2Ptr & GetTarget() const
Returns the target particle system to emit.
std::function< void(ParticleEmitter2 *, double, double)> OnBeginUpdateCallback
Callback function type for update calls.
Definition: ParticleEmitter2.h:28
void Update(double currentTimeInSeconds, double timeIntervalInSeconds)
virtual void OnUpdate(double currentTimeInSeconds, double timeIntervalInSeconds)=0
Called when ParticleEmitter2::Update is executed.
virtual ~ParticleEmitter2()
Destructor.
ParticleEmitter2()
Default constructor.
Abstract base class for 2-D particle emitter.
Definition: ParticleEmitter2.h:19