Platformer
Platformer
LambdaComponent.hpp
1 #ifndef LAMBDACOMPONENT_HPP
2 #define LAMBDACOMPONENT_HPP
3 
4 #include <functional>
5 
6 #include "Component.hpp"
7 
9 class LambdaComponent : public Component {
10  public:
11 
14  std::function<void(GameObject&)> fun);
15 
16  virtual void Update();
17 
18  private:
20  std::function<void(GameObject&)> fun;
21 };
22 
23 #endif
A class for adding a function to the given component&#39;s update loop.
Definition: LambdaComponent.hpp:9
std::function< void(GameObject &)> fun
The function to be called when updating.
Definition: LambdaComponent.hpp:20
LambdaComponent(std::function< void(GameObject &)> fun)
Construts a new lambda component.
Definition: LambdaComponent.cpp:3
Class representing a component of a GameObject.
Definition: Component.hpp:12
A GameObject class.
Definition: GameObject.hpp:14
virtual void Update()
Updates this component.
Definition: LambdaComponent.cpp:5