From 0d3f137e525da93998a403dba975da8da5087220 Mon Sep 17 00:00:00 2001 From: asdqwe Date: Mon, 21 Oct 2024 14:37:57 -0300 Subject: [PATCH] Revert low/high parameters back to left/rightMotor --- src/platforms/rcore_android.c | 2 +- src/platforms/rcore_desktop_glfw.c | 2 +- src/platforms/rcore_desktop_sdl.c | 12 ++++++------ src/platforms/rcore_drm.c | 2 +- src/platforms/rcore_web.c | 2 +- src/raylib.h | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/platforms/rcore_android.c b/src/platforms/rcore_android.c index 099719a29..c730d34bd 100644 --- a/src/platforms/rcore_android.c +++ b/src/platforms/rcore_android.c @@ -615,7 +615,7 @@ int SetGamepadMappings(const char *mappings) } // Set gamepad vibration -void SetGamepadVibration(int gamepad, float low, float high, int duration) +void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, int duration) { TRACELOG(LOG_WARNING, "GamepadSetVibration() not implemented on target platform"); } diff --git a/src/platforms/rcore_desktop_glfw.c b/src/platforms/rcore_desktop_glfw.c index 222a7245a..1234b7c6b 100644 --- a/src/platforms/rcore_desktop_glfw.c +++ b/src/platforms/rcore_desktop_glfw.c @@ -1060,7 +1060,7 @@ int SetGamepadMappings(const char *mappings) } // Set gamepad vibration -void SetGamepadVibration(int gamepad, float low, float high, int duration) +void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, int duration) { TRACELOG(LOG_WARNING, "GamepadSetVibration() not available on target platform"); } diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c index df4b987df..a31b37e3d 100644 --- a/src/platforms/rcore_desktop_sdl.c +++ b/src/platforms/rcore_desktop_sdl.c @@ -953,17 +953,17 @@ int SetGamepadMappings(const char *mappings) } // Set gamepad vibration -void SetGamepadVibration(int gamepad, float low, float high, int duration) +void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, int duration) { if ((gamepad < MAX_GAMEPADS) && CORE.Input.Gamepad.ready[gamepad] && (duration > 0)) { - if (low < 0.0f) low = 0.0f; - if (low > 1.0f) low = 1.0f; - if (high < 0.0f) high = 0.0f; - if (high > 1.0f) high = 1.0f; + if (leftMotor < 0.0f) leftMotor = 0.0f; + if (leftMotor > 1.0f) leftMotor = 1.0f; + if (rightMotor < 0.0f) rightMotor = 0.0f; + if (rightMotor > 1.0f) rightMotor = 1.0f; if (duration > MAX_GAMEPAD_VIBRATION_TIME) duration = MAX_GAMEPAD_VIBRATION_TIME; - SDL_GameControllerRumble(platform.gamepad[gamepad], (Uint16)(low*65535.0f), (Uint16)(high*65535.0f), (Uint32)duration); + SDL_GameControllerRumble(platform.gamepad[gamepad], (Uint16)(leftMotor*65535.0f), (Uint16)(rightMotor*65535.0f), (Uint32)duration); } } diff --git a/src/platforms/rcore_drm.c b/src/platforms/rcore_drm.c index 910d22c22..a9f7ce377 100644 --- a/src/platforms/rcore_drm.c +++ b/src/platforms/rcore_drm.c @@ -610,7 +610,7 @@ int SetGamepadMappings(const char *mappings) } // Set gamepad vibration -void SetGamepadVibration(int gamepad, float low, float high, int duration) +void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, int duration) { TRACELOG(LOG_WARNING, "GamepadSetVibration() not implemented on target platform"); } diff --git a/src/platforms/rcore_web.c b/src/platforms/rcore_web.c index e94492764..a83f7c2d2 100644 --- a/src/platforms/rcore_web.c +++ b/src/platforms/rcore_web.c @@ -892,7 +892,7 @@ int SetGamepadMappings(const char *mappings) } // Set gamepad vibration -void SetGamepadVibration(int gamepad, float low, float high, int duration) +void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, int duration) { TRACELOG(LOG_WARNING, "GamepadSetVibration() not implemented on target platform"); } diff --git a/src/raylib.h b/src/raylib.h index ea2416950..31a170ee5 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1184,7 +1184,7 @@ RLAPI int GetGamepadButtonPressed(void); RLAPI int GetGamepadAxisCount(int gamepad); // Get gamepad axis count for a 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 low, float high, int duration); // Set gamepad vibration for both motors (duration in ms) +RLAPI void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, int duration) // Set gamepad vibration for both motors (duration in ms) // Input-related functions: mouse RLAPI bool IsMouseButtonPressed(int button); // Check if a mouse button has been pressed once