1 #ifndef _RIVE_STATE_MACHINE_LISTENER_HPP_
2 #define _RIVE_STATE_MACHINE_LISTENER_HPP_
3 #include "rive/generated/animation/state_machine_listener_base.hpp"
4 #include "rive/listener_type.hpp"
5 #include "rive/math/vec2d.hpp"
9 class StateMachineListenerImporter;
11 class StateMachineInstance;
12 class StateMachineListener : public StateMachineListenerBase {
13 friend class StateMachineListenerImporter;
16 std::vector<uint32_t> m_HitShapesIds;
17 std::vector<std::unique_ptr<ListenerAction>> m_Actions;
18 void addAction(std::unique_ptr<ListenerAction>);
21 StateMachineListener();
22 ~StateMachineListener() override;
24 ListenerType listenerType() const { return (ListenerType)listenerTypeValue(); }
25 size_t actionCount() const { return m_Actions.size(); }
27 const ListenerAction* action(size_t index) const;
28 StatusCode import(ImportStack& importStack) override;
29 StatusCode onAddedClean(CoreContext* context) override;
31 const std::vector<uint32_t>& hitShapeIds() const { return m_HitShapesIds; }
32 void performChanges(StateMachineInstance* stateMachineInstance, Vec2D position) const;