From 35e3896dc1679b075c6d06a2bbce8e09a18637bf Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 14 Mar 2022 15:18:01 +0100 Subject: [PATCH] fixed new InputHandler deadzone querying equality being inverted --- MLEM/Input/InputHandler.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/MLEM/Input/InputHandler.cs b/MLEM/Input/InputHandler.cs index 23a24fe..82c052b 100644 --- a/MLEM/Input/InputHandler.cs +++ b/MLEM/Input/InputHandler.cs @@ -61,7 +61,7 @@ namespace MLEM.Input { public bool StoreAllActiveInputs; /// /// This field represents the deadzone that gamepad have when input is queried for them using this input handler. - /// A deadzone is the percentage (between 0 and 1) that an analog value has to reach for it to be considered down () or pressed (). + /// A deadzone is the percentage (between 0 and 1) that an analog value has to exceed for it to be considered down () or pressed (). /// Querying of analog values is done using . /// public float GamepadButtonDeadzone; @@ -451,48 +451,48 @@ namespace MLEM.Input { public bool IsGamepadButtonDown(Buttons button, int index = -1) { if (index < 0) { for (var i = 0; i < this.ConnectedGamepads; i++) { - if (this.GetGamepadState(i).GetAnalogValue(button) >= this.GamepadButtonDeadzone) + if (this.GetGamepadState(i).GetAnalogValue(button) > this.GamepadButtonDeadzone) return true; } return false; } - return this.GetGamepadState(index).GetAnalogValue(button) >= this.GamepadButtonDeadzone; + return this.GetGamepadState(index).GetAnalogValue(button) > this.GamepadButtonDeadzone; } /// public bool IsGamepadButtonUp(Buttons button, int index = -1) { if (index < 0) { for (var i = 0; i < this.ConnectedGamepads; i++) { - if (this.GetGamepadState(i).GetAnalogValue(button) < this.GamepadButtonDeadzone) + if (this.GetGamepadState(i).GetAnalogValue(button) <= this.GamepadButtonDeadzone) return true; } return false; } - return this.GetGamepadState(index).GetAnalogValue(button) < this.GamepadButtonDeadzone; + return this.GetGamepadState(index).GetAnalogValue(button) <= this.GamepadButtonDeadzone; } /// public bool WasGamepadButtonDown(Buttons button, int index = -1) { if (index < 0) { for (var i = 0; i < this.ConnectedGamepads; i++) { - if (this.GetLastGamepadState(i).GetAnalogValue(button) >= this.GamepadButtonDeadzone) + if (this.GetLastGamepadState(i).GetAnalogValue(button) > this.GamepadButtonDeadzone) return true; } return false; } - return this.GetLastGamepadState(index).GetAnalogValue(button) >= this.GamepadButtonDeadzone; + return this.GetLastGamepadState(index).GetAnalogValue(button) > this.GamepadButtonDeadzone; } /// public bool WasGamepadButtonUp(Buttons button, int index = -1) { if (index < 0) { for (var i = 0; i < this.ConnectedGamepads; i++) { - if (this.GetLastGamepadState(i).GetAnalogValue(button) < this.GamepadButtonDeadzone) + if (this.GetLastGamepadState(i).GetAnalogValue(button) <= this.GamepadButtonDeadzone) return true; } return false; } - return this.GetLastGamepadState(index).GetAnalogValue(button) < this.GamepadButtonDeadzone; + return this.GetLastGamepadState(index).GetAnalogValue(button) <= this.GamepadButtonDeadzone; } ///