Peoplemon  0.1.0
Peoplemon 3 game source documentation
PlayerControlled.hpp
Go to the documentation of this file.
1 #ifndef CORE_COMPONENTS_PLAYERCONTROLLED_HPP
2 #define CORE_COMPONENTS_PLAYERCONTROLLED_HPP
3 
5 #include <Core/Input/Control.hpp>
6 
7 namespace core
8 {
9 namespace system
10 {
11 class Systems;
12 }
13 
14 namespace component
15 {
22 class PlayerControlled : public bl::input::Listener {
23 public:
31  PlayerControlled(system::Systems& systems, Controllable& controllable);
32 
37  virtual ~PlayerControlled() = default;
38 
44  void start();
45 
50  void stop();
51 
57  virtual bool observe(const bl::input::Actor&, unsigned int ctrl, bl::input::DispatchType,
58  bool) override;
59 
60 private:
61  system::Systems& systems;
62  component::Controllable& controllable;
63  bool started;
64 };
65 
66 } // namespace component
67 } // namespace core
68 
69 #endif
Core classes and functionality for both the editor and game.
Adding this component to an entity allows it to be controlled.
Add this component to an entity to make it controlled by player input.
virtual ~PlayerControlled()=default
Destroy the Player Controlled component.
PlayerControlled(system::Systems &systems, Controllable &controllable)
Construct a new Player Controlled component and immediately start taking player input....
void start()
Activate this listener and receive player input. Does not have effect if already activated but anothe...
virtual bool observe(const bl::input::Actor &, unsigned int ctrl, bl::input::DispatchType, bool) override
Forwards the player input to the underlying entity.
void stop()
Stops listening to player input.
Owns all primary systems and a reference to the engine.
Definition: Systems.hpp:47