diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2021-10-28 15:19:35 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2021-10-28 15:19:35 +0200 |
commit | 3b11e33a099daa0978147a7550dd84ba5dd14f35 (patch) | |
tree | 310a87f4da4bd345fc1b12a3b0965558e5ae01f2 /core/input | |
parent | 8508f9396d2a063885798593c0cef18265b4c87a (diff) |
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.
`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
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] = { |