3 #include <Dispatcher.hpp>
6 #include <SFML/System.hpp>
22 virtual ~
State() =
default;
26 virtual void update(
const sf::Time deltaT);
28 void handleEvent(
const Event &event);
30 void registerEventResponse(
const std::string eventId,
const std::function<
void(
const Event &)> response);
31 void registerTransition(
const std::string eventId,
const StateTransition &transition);
32 void registerTransition(
const std::string eventId, std::shared_ptr<State> &target);
45 std::shared_ptr<State> &getTargetState()
const;
46 virtual bool guard(
const Event &trigger)
const;
47 virtual void effect()
const;
50 std::shared_ptr<State> &_target;
55 void start(std::shared_ptr<State> &initialState);
56 bool isStarted()
const;
57 void update(
const sf::Time deltaT);
60 State &getState()
const;
64 std::shared_ptr<State> _currentState;
66 void setState(std::shared_ptr<State> &state);
67 void passEventToCurrentState(
const Event &event);
A class for managing events.
Definition: Dispatcher.hpp:18
A class representing an event that has occurred.
Definition: Event.hpp:10
Definition: StateMachine.hpp:40
Definition: StateMachine.hpp:19
Definition: StateMachine.hpp:13