diff options
Diffstat (limited to 'core/input')
-rw-r--r-- | core/input/input.cpp | 19 | ||||
-rw-r--r-- | core/input/input_event.cpp | 8 |
2 files changed, 14 insertions, 13 deletions
diff --git a/core/input/input.cpp b/core/input/input.cpp index c3b43a4274..12028efc56 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -164,10 +164,11 @@ void Input::_bind_methods() { void Input::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const { String pf = p_function; - if (p_idx == 0 && (pf == "is_action_pressed" || pf == "action_press" || pf == "action_release" || - pf == "is_action_just_pressed" || pf == "is_action_just_released" || - pf == "get_action_strength" || pf == "get_action_raw_strength" || - pf == "get_axis" || pf == "get_vector")) { + if (p_idx == 0 && + (pf == "is_action_pressed" || pf == "action_press" || pf == "action_release" || + pf == "is_action_just_pressed" || pf == "is_action_just_released" || + pf == "get_action_strength" || pf == "get_action_raw_strength" || + pf == "get_axis" || pf == "get_vector")) { List<PropertyInfo> pinfo; ProjectSettings::get_singleton()->get_property_list(&pinfo); @@ -315,11 +316,11 @@ Vector2 Input::get_vector(const StringName &p_negative_x, const StringName &p_po if (p_deadzone < 0.0f) { // If the deadzone isn't specified, get it from the average of the actions. - p_deadzone = (InputMap::get_singleton()->action_get_deadzone(p_positive_x) + - InputMap::get_singleton()->action_get_deadzone(p_negative_x) + - InputMap::get_singleton()->action_get_deadzone(p_positive_y) + - InputMap::get_singleton()->action_get_deadzone(p_negative_y)) / - 4; + p_deadzone = 0.25 * + (InputMap::get_singleton()->action_get_deadzone(p_positive_x) + + InputMap::get_singleton()->action_get_deadzone(p_negative_x) + + InputMap::get_singleton()->action_get_deadzone(p_positive_y) + + InputMap::get_singleton()->action_get_deadzone(p_negative_y)); } // Circular length limiting and deadzone. diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp index c6448b1e44..af3190bb17 100644 --- a/core/input/input_event.cpp +++ b/core/input/input_event.cpp @@ -454,10 +454,10 @@ bool InputEventKey::is_match(const Ref<InputEvent> &p_event, bool p_exact_match) if (keycode == 0) { return physical_keycode == key->physical_keycode && - (!p_exact_match || get_modifiers_mask() == key->get_modifiers_mask()); + (!p_exact_match || get_modifiers_mask() == key->get_modifiers_mask()); } else { return keycode == key->keycode && - (!p_exact_match || get_modifiers_mask() == key->get_modifiers_mask()); + (!p_exact_match || get_modifiers_mask() == key->get_modifiers_mask()); } } @@ -616,7 +616,7 @@ bool InputEventMouseButton::is_match(const Ref<InputEvent> &p_event, bool p_exac } return button_index == mb->button_index && - (!p_exact_match || get_modifiers_mask() == mb->get_modifiers_mask()); + (!p_exact_match || get_modifiers_mask() == mb->get_modifiers_mask()); } static const char *_mouse_button_descriptions[9] = { @@ -935,7 +935,7 @@ bool InputEventJoypadMotion::is_match(const Ref<InputEvent> &p_event, bool p_exa } return axis == jm->axis && - (!p_exact_match || ((axis_value < 0) == (jm->axis_value < 0))); + (!p_exact_match || ((axis_value < 0) == (jm->axis_value < 0))); } static const char *_joy_axis_descriptions[JOY_AXIS_MAX] = { |