Platformer
Platformer
Button.hpp
1 #ifndef BUTTON_HPP
2 #define BUTTON_HPP
3 
4 #include <functional>
5 
6 #include "Component.hpp"
7 
9 class Button : public Component {
10  public:
12  Button(
13  std::function<void(GameObject&)> onClick);
14 
15  virtual void Update();
16 
17  private:
19  std::function<void(GameObject&)> fun;
20 };
21 
22 #endif
virtual void Update()
Updates this component.
Definition: Button.cpp:7
A basic button component class.
Definition: Button.hpp:9
std::function< void(GameObject &)> fun
The function to be called upon click.
Definition: Button.hpp:19
Class representing a component of a GameObject.
Definition: Component.hpp:12
A GameObject class.
Definition: GameObject.hpp:14
Button(std::function< void(GameObject &)> onClick)
Creates a new button that calls the given function.
Definition: Button.cpp:5