mirror of
https://github.com/glfw/glfw.git
synced 2025-10-02 21:00:57 +00:00
minor refactoring, documentation tweaks
This commit is contained in:
parent
b0840ad5bb
commit
6db3f00ffb
@ -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.
|
||||
*
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user