GridEmitter2.h
Go to the documentation of this file.
1 /*************************************************************************
2 > File Name: GridEmitter2.h
3 > Project Name: CubbyFlow
4 > Author: Chan-Ho Chris Ohk
5 > Purpose: Abstract base class for 2-D grid-based emitters.
6 > Created Time: 2017/08/06
7 > Copyright (c) 2018, Chan-Ho Chris Ohk
8 *************************************************************************/
9 #ifndef CUBBYFLOW_GRID_EMITTER2_H
10 #define CUBBYFLOW_GRID_EMITTER2_H
11 
12 #include <functional>
13 #include <memory>
14 
15 namespace CubbyFlow
16 {
21  {
22  public:
29  using OnBeginUpdateCallback = std::function<void(GridEmitter2*, double, double)>;
30 
32  GridEmitter2();
33 
35  virtual ~GridEmitter2();
36 
39  void Update(double currentTimeInSeconds, double timeIntervalInSeconds);
40 
51  void SetOnBeginUpdateCallback(const OnBeginUpdateCallback& callback);
52 
53  protected:
54  virtual void OnUpdate(double currentTimeInSeconds, double timeIntervalInSeconds) = 0;
55 
56  void CallOnBeginUpdateCallback(double currentTimeInSeconds, double timeIntervalInSeconds);
57 
58  private:
59  OnBeginUpdateCallback m_onBeginUpdateCallback;
60  };
61 
63  using GridEmitter2Ptr = std::shared_ptr<GridEmitter2>;
64 }
65 
66 #endif
GridEmitter2()
Constructs an emitter.
std::function< void(GridEmitter2 *, double, double)> OnBeginUpdateCallback
Callback function type for update calls.
Definition: GridEmitter2.h:29
void Update(double currentTimeInSeconds, double timeIntervalInSeconds)
void SetOnBeginUpdateCallback(const OnBeginUpdateCallback &callback)
Sets the callback function to be called when GridEmitter2::Update function is invoked.
Abstract base class for 2-D grid-based emitters.
Definition: GridEmitter2.h:20
std::shared_ptr< GridEmitter2 > GridEmitter2Ptr
Shared pointer type for the GridEmitter2.
Definition: GridEmitter2.h:63
Definition: pybind11Utils.h:24
virtual void OnUpdate(double currentTimeInSeconds, double timeIntervalInSeconds)=0
void CallOnBeginUpdateCallback(double currentTimeInSeconds, double timeIntervalInSeconds)
virtual ~GridEmitter2()
Destructor.