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