From 2bc0b76050dfca7dd94a49f289f3b3e4fa85a466 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Thu, 19 Mar 2026 03:24:19 +0100 Subject: [PATCH] fix: joypad drift threshold + move InputDevice enum inside class --- Autoloads/InputDeviceManager.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Autoloads/InputDeviceManager.cs b/Autoloads/InputDeviceManager.cs index 76241d1..754f56e 100644 --- a/Autoloads/InputDeviceManager.cs +++ b/Autoloads/InputDeviceManager.cs @@ -2,10 +2,9 @@ using Godot; namespace Mr.BrickAdventures.Autoloads; -public enum InputDevice { Mouse, Keyboard, Gamepad } - public partial class InputDeviceManager : Node { + public enum InputDevice { Mouse, Keyboard, Gamepad } public static InputDeviceManager Instance { get; private set; } public InputDevice CurrentDevice { get; private set; } = InputDevice.Mouse; @@ -33,8 +32,13 @@ public partial class InputDeviceManager : Node detected = InputDevice.Mouse; else if (@event is InputEventKey) detected = InputDevice.Keyboard; - else if (@event is InputEventJoypadButton or InputEventJoypadMotion) + else if (@event is InputEventJoypadButton) detected = InputDevice.Gamepad; + else if (@event is InputEventJoypadMotion joyEvent) + { + if (Mathf.Abs(joyEvent.AxisValue) <= 0.15f) return; + detected = InputDevice.Gamepad; + } else return;