#ifndef PLAYER_INPUT_HPP #define PLAYER_INPUT_HPP #include #include "godot_cpp/classes/input_event.hpp" #include "godot_cpp/classes/node.hpp" namespace godot { class PlayerInput : public Node { GDCLASS(PlayerInput, Node) static void _bind_methods(); public: struct Listener { String actionNegative{""}; String actionPositive{""}; float lastCached{0.f}; String methodName{""}; Node *object; Listener(String positive, String negative, Node *object, String method); bool has_changed(Ref const &event); float evaluate(Ref const &event); bool operator==(godot::PlayerInput::Listener const& b); }; private: std::vector listeners; public: virtual void _unhandled_input(Ref const &event) override; void listen_to(Listener const& listener); void stop_listening(Node *node); void stop_listening(Listener const& listener); }; } #endif // !PLAYER_INPUT_HPP