|
@@ -962,6 +962,22 @@ bool InputEventAction::is_action(const StringName &p_action) const {
|
|
return action == p_action;
|
|
return action == p_action;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+bool InputEventAction::action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const {
|
|
|
|
+
|
|
|
|
+ Ref<InputEventAction> act = p_event;
|
|
|
|
+ if (act.is_null())
|
|
|
|
+ return false;
|
|
|
|
+
|
|
|
|
+ bool match = action == act->action;
|
|
|
|
+ if (match) {
|
|
|
|
+ if (p_pressed != NULL)
|
|
|
|
+ *p_pressed = act->pressed;
|
|
|
|
+ if (p_strength != NULL)
|
|
|
|
+ *p_strength = (*p_pressed) ? 1.0f : 0.0f;
|
|
|
|
+ }
|
|
|
|
+ return match;
|
|
|
|
+}
|
|
|
|
+
|
|
String InputEventAction::as_text() const {
|
|
String InputEventAction::as_text() const {
|
|
|
|
|
|
return "InputEventAction : action=" + action + ", pressed=(" + (pressed ? "true" : "false");
|
|
return "InputEventAction : action=" + action + ", pressed=(" + (pressed ? "true" : "false");
|