diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2020-11-10 01:21:13 -0500 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2020-11-11 06:02:44 -0500 |
commit | 4abf189e367b5b5f9846fd9dd3a3cade69e28505 (patch) | |
tree | c6613fba0afef06ac5b2cf5b815befb7adfa0920 /core/input/input_map.cpp | |
parent | 195d58be0fc7ce5120e3909c5db87e08d9de6bdb (diff) |
Allow getting Input axis/vector values by specifying multiple actions
For get_vector, use raw values and handle deadzones appropriately
Diffstat (limited to 'core/input/input_map.cpp')
-rw-r--r-- | core/input/input_map.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
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) + "'."); |