GameKit  0.0.1a
C++ gamedev tools
EasyBehaviour.hpp
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: EasyBehaviour.hpp
5  *
6  * Description:
7  *
8  * Created: 19/01/2018 03:52:45
9  *
10  * Author: Quentin Bazin, <quent42340@gmail.com>
11  *
12  * =====================================================================================
13  */
14 #ifndef GK_EASYBEHAVIOUR_HPP_
15 #define GK_EASYBEHAVIOUR_HPP_
16 
17 #include <functional>
18 
20 
21 namespace gk {
22 
23 class EasyBehaviour : public Behaviour {
24  public:
25  EasyBehaviour(const std::function<void(SceneObject &)> &func) : m_func(func) {}
26 
27  void update(SceneObject &object) override {
28  m_func(object);
29  }
30 
31  private:
32  std::function<void(SceneObject &)> m_func;
33 };
34 
35 } // namespace gk
36 
37 #endif // GK_EASYBEHAVIOUR_HPP_
void update(SceneObject &object) override
std::function< void(SceneObject &)> m_func
EasyBehaviour(const std::function< void(SceneObject &)> &func)