diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index cd6b53b5a..cd120b46d 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -5348,16 +5348,18 @@ GLFWAPI const char* glfwGetGamepadName(int jid); */ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state); -/*! @brief Sets the specified gamepad's vibration effect intensity. +/*! @brief Sets the intensity of an Xbox-like gamepad's rumble effect. * - * This function sends vibration data to the specified Xbox-like gamepad. + * This function sends vibration data to gamepads that implement haptic + * feedback effects using two vibration motors: a low-frequency motor, and + * a high-frequency motor. * * Vibration intensity is a value between 0.0 and 1.0 inclusive, where 0.0 is no * vibration, and 1.0 is maximum vibration. It is set separately for the * gamepad's low frequency and high frequency rumble motors. * * If the specified gamepad is not present or does not support the rumble - * effect, this function will return `GLFW_FALSE` but will not generate an + * effect, this function will return `GLFW_FALSE` but will not generate an * error. * * @param[in] jid The [joystick](@ref joysticks) to vibrate. @@ -5377,7 +5379,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state); * * @ingroup input */ -GLFWAPI int glfwSetGamepadRumble(int jid, float slowMotorSpeed, float fastMotorSpeed); +GLFWAPI int glfwSetJoystickRumble(int jid, float slowMotorSpeed, float fastMotorSpeed); /*! @brief Sets the clipboard to the specified string. * diff --git a/src/input.c b/src/input.c index 35fbb072c..e18e0740b 100644 --- a/src/input.c +++ b/src/input.c @@ -1312,7 +1312,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state) return GLFW_TRUE; } -GLFWAPI int glfwSetGamepadRumble(int jid, float slowMotorSpeed, float fastMotorSpeed) +GLFWAPI int glfwSetJoystickRumble(int jid, float slowMotorSpeed, float fastMotorSpeed) { _GLFWjoystick* js; @@ -1337,7 +1337,7 @@ GLFWAPI int glfwSetGamepadRumble(int jid, float slowMotorSpeed, float fastMotorS fastMotorSpeed = fastMotorSpeed < 0.0f ? 0.0f : fastMotorSpeed; fastMotorSpeed = fastMotorSpeed > 1.0f ? 1.0f : fastMotorSpeed; - return _glfwPlatformSetGamepadRumble(js, slowMotorSpeed, fastMotorSpeed); + return _glfwPlatformSetJoystickRumble(js, slowMotorSpeed, fastMotorSpeed); } GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string) diff --git a/src/internal.h b/src/internal.h index 99f7f3f76..e451d9c3f 100644 --- a/src/internal.h +++ b/src/internal.h @@ -628,7 +628,7 @@ const char* _glfwPlatformGetClipboardString(void); int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode); void _glfwPlatformUpdateGamepadGUID(char* guid); -int _glfwPlatformSetGamepadRumble(_GLFWjoystick* js, float slowMotorSpeed, float fastMotorSpeed); +int _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorSpeed, float fastMotorSpeed); uint64_t _glfwPlatformGetTimerValue(void); uint64_t _glfwPlatformGetTimerFrequency(void); diff --git a/src/linux_joystick.c b/src/linux_joystick.c index 9f278e839..a8182612f 100644 --- a/src/linux_joystick.c +++ b/src/linux_joystick.c @@ -479,7 +479,7 @@ void _glfwPlatformUpdateGamepadGUID(char* guid) } -int _glfwPlatformSetGamepadRumble(_GLFWjoystick* js, float slowMotorSpeed, float fastMotorSpeed) +int _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorSpeed, float fastMotorSpeed) { _GLFWjoystickLinux *linjs = &js->linjs; diff --git a/src/win32_joystick.c b/src/win32_joystick.c index e707d7b08..4c0b0b5c5 100644 --- a/src/win32_joystick.c +++ b/src/win32_joystick.c @@ -753,7 +753,7 @@ void _glfwPlatformUpdateGamepadGUID(char* guid) } } -int _glfwPlatformSetGamepadRumble(_GLFWjoystick* js, float slowMotorSpeed, float fastMotorSpeed) +int _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorSpeed, float fastMotorSpeed) { if (js->win32.device) return GLFW_FALSE; diff --git a/tests/joysticks.c b/tests/joysticks.c index 562535b34..038c9a13f 100644 --- a/tests/joysticks.c +++ b/tests/joysticks.c @@ -242,7 +242,7 @@ int main(void) slowRumble[i] = nk_slide_float(nk, 0.0f, slowRumble[i], 1.0f, 0.05f); fastRumble[i] = nk_slide_float(nk, 0.0f, fastRumble[i], 1.0f, 0.05f); - glfwSetGamepadRumble(joysticks[i], slowRumble[i], fastRumble[i]); + glfwSetJoystickRumble(joysticks[i], slowRumble[i], fastRumble[i]); } } else