Building Game Engines
ControllerComponent.hpp
Go to the documentation of this file.
1 #ifndef CONTROLLER_COMPONENT_HPP
2 #define CONTROLLER_COMPONENT_HPP
3 
4 #include "Component.hpp"
5 #include "TransformComponent.hpp"
6 
11  public:
16 
21 
25  virtual void Update();
26 
30  virtual void Render(SDL_Renderer* renderer);
31 
35  void Input(SDL_Event e);
36 
37  private:
38  // Points to the transform of the game object this component is attached to
39  TransformComponent* transform;
40 
41  // Stores the buttons that are pressed by the player
42  bool buttons[3];
43 
44  // The speed of the game object this component is attached to
45  int speed = 5;
46 };
47 
48 #endif
ControllerComponent(TransformComponent *transform)
Definition: ControllerComponent.cpp:5
Definition: ControllerComponent.hpp:10
virtual void Update()
Definition: ControllerComponent.cpp:39
Definition: TransformComponent.hpp:9
Definition: Component.hpp:10
virtual void Render(SDL_Renderer *renderer)
Definition: ControllerComponent.cpp:41
void Input(SDL_Event e)
Definition: ControllerComponent.cpp:17
~ControllerComponent()
Definition: ControllerComponent.cpp:13