minor refactoring, documentation tweaks

This commit is contained in:
Nikita Leonidov 2020-04-16 10:29:52 -04:00
parent b0840ad5bb
commit 6db3f00ffb
6 changed files with 12 additions and 10 deletions

View File

@ -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.
*

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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