feat: added new constructor for Listener

stripped
Sara 2024-02-23 21:50:29 +01:00
parent 3253888829
commit 76fa584333
2 changed files with 4 additions and 0 deletions

View File

@ -19,6 +19,9 @@ PlayerInput::Listener::Listener(String positive, String negative, Node *object,
, object{object} , object{object}
, isMouseEvent{positive.begins_with("_mouse_") || negative.begins_with("_mouse_")} {} , isMouseEvent{positive.begins_with("_mouse_") || negative.begins_with("_mouse_")} {}
PlayerInput::Listener::Listener(String action, Node *object, String method)
: PlayerInput::Listener::Listener(action, "", object, method) {}
std::optional<float> PlayerInput::Listener::evaluate_action(String const &action) { std::optional<float> PlayerInput::Listener::evaluate_action(String const &action) {
Input *input = Input::get_singleton(); Input *input = Input::get_singleton();
if(action.begins_with("_mouse_")) { if(action.begins_with("_mouse_")) {

View File

@ -38,6 +38,7 @@ public:
public: public:
Listener(String positive, String negative, Node *object, String method); Listener(String positive, String negative, Node *object, String method);
Listener(String action, Node *object, String method);
// evaluate the current state of an action. // evaluate the current state of an action.
static std::optional<float> evaluate_action(String const &action); static std::optional<float> evaluate_action(String const &action);
// check if this event has any chance to result in a trigger, does not evaluate the event or // check if this event has any chance to result in a trigger, does not evaluate the event or