From 5cb0cd13de426d07fb667145ebb70e911bab038b Mon Sep 17 00:00:00 2001 From: asdqwe Date: Tue, 22 Oct 2024 19:43:34 -0300 Subject: [PATCH] Remove default global deadzone --- src/raylib.h | 1 - src/rcore.c | 12 +----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/raylib.h b/src/raylib.h index 25a015d57..fc505f787 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1185,7 +1185,6 @@ RLAPI int GetGamepadAxisCount(int gamepad); RLAPI float GetGamepadAxisMovement(int gamepad, int axis); // Get axis movement value for a gamepad axis RLAPI int SetGamepadMappings(const char *mappings); // Set internal gamepad mappings (SDL_GameControllerDB) RLAPI void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration); // Set gamepad vibration for both motors (duration in seconds) -RLAPI void SetGamepadDeadzone(float deadzone); // Set gamepad global deadzone // Input-related functions: mouse RLAPI bool IsMouseButtonPressed(int button); // Check if a mouse button has been pressed once diff --git a/src/rcore.c b/src/rcore.c index 4e85bd79c..9734972cf 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -349,7 +349,6 @@ typedef struct CoreData { char currentButtonState[MAX_GAMEPADS][MAX_GAMEPAD_BUTTONS]; // Current gamepad buttons state char previousButtonState[MAX_GAMEPADS][MAX_GAMEPAD_BUTTONS]; // Previous gamepad buttons state float axisState[MAX_GAMEPADS][MAX_GAMEPAD_AXIS]; // Gamepad axis state - float globalDeadzone; // Global gamepad axis deadzone } Gamepad; } Input; @@ -643,7 +642,6 @@ void InitWindow(int width, int height, const char *title) CORE.Input.Mouse.scale = (Vector2){ 1.0f, 1.0f }; CORE.Input.Mouse.cursor = MOUSE_CURSOR_ARROW; CORE.Input.Gamepad.lastButtonPressed = GAMEPAD_BUTTON_UNKNOWN; - CORE.Input.Gamepad.globalDeadzone = 0.1f; // Initialize platform //-------------------------------------------------------------- @@ -3297,20 +3295,12 @@ float GetGamepadAxisMovement(int gamepad, int axis) if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (axis < MAX_GAMEPAD_AXIS)) { float movement = value < 0.0f ? CORE.Input.Gamepad.axisState[gamepad][axis] : fabsf(CORE.Input.Gamepad.axisState[gamepad][axis]); - // 0.1f = GAMEPAD_AXIS_MINIMUM_DRIFT/DELTA - if (movement > value + CORE.Input.Gamepad.globalDeadzone) value = CORE.Input.Gamepad.axisState[gamepad][axis]; + if (movement > value) value = CORE.Input.Gamepad.axisState[gamepad][axis]; } return value; } -// Set gamepad global deadzone -void SetGamepadDeadzone(float deadzone) -{ - if (deadzone < 0.0f) deadzone = 0.0f; - CORE.Input.Gamepad.globalDeadzone = deadzone; -} - //---------------------------------------------------------------------------------- // Module Functions Definition: Input Handling: Mouse //----------------------------------------------------------------------------------