From 76fa584333c32e96de92aebe2006807ce264c1a6 Mon Sep 17 00:00:00 2001 From: Sara Date: Fri, 23 Feb 2024 21:50:29 +0100 Subject: [PATCH] feat: added new constructor for Listener --- player_input.cpp | 3 +++ player_input.hpp | 1 + 2 files changed, 4 insertions(+) diff --git a/player_input.cpp b/player_input.cpp index 5d1ce0e..a4ca823 100644 --- a/player_input.cpp +++ b/player_input.cpp @@ -19,6 +19,9 @@ PlayerInput::Listener::Listener(String positive, String negative, Node *object, , object{object} , 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 PlayerInput::Listener::evaluate_action(String const &action) { Input *input = Input::get_singleton(); if(action.begins_with("_mouse_")) { diff --git a/player_input.hpp b/player_input.hpp index f300746..06f83c8 100644 --- a/player_input.hpp +++ b/player_input.hpp @@ -38,6 +38,7 @@ public: public: Listener(String positive, String negative, Node *object, String method); + Listener(String action, Node *object, String method); // evaluate the current state of an action. static std::optional evaluate_action(String const &action); // check if this event has any chance to result in a trigger, does not evaluate the event or