From 4abf189e367b5b5f9846fd9dd3a3cade69e28505 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Tue, 10 Nov 2020 01:21:13 -0500 Subject: Allow getting Input axis/vector values by specifying multiple actions For get_vector, use raw values and handle deadzones appropriately --- core/input/input_map.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'core/input/input_map.cpp') diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp index 02013c8c9c..719667e7ab 100644 --- a/core/input/input_map.cpp +++ b/core/input/input_map.cpp @@ -118,6 +118,12 @@ bool InputMap::has_action(const StringName &p_action) const { return input_map.has(p_action); } +float InputMap::action_get_deadzone(const StringName &p_action) { + ERR_FAIL_COND_V_MSG(!input_map.has(p_action), 0.0f, "Request for nonexistent InputMap action '" + String(p_action) + "'."); + + return input_map[p_action].deadzone; +} + void InputMap::action_set_deadzone(const StringName &p_action, float p_deadzone) { ERR_FAIL_COND_MSG(!input_map.has(p_action), "Request for nonexistent InputMap action '" + String(p_action) + "'."); -- cgit v1.2.3