mirror of
https://github.com/glfw/glfw.git
synced 2025-10-03 05:11:01 +00:00
give parameters more sensible names
This commit is contained in:
parent
7734040b22
commit
7e7d8110fc
4
deps/mingw/xinput.h
vendored
4
deps/mingw/xinput.h
vendored
@ -182,8 +182,8 @@ typedef struct _XINPUT_STATE {
|
||||
*/
|
||||
|
||||
typedef struct _XINPUT_VIBRATION {
|
||||
WORD wLeftMotorSpeed;
|
||||
WORD wRightMotorSpeed;
|
||||
WORD wLeftMotorIntensity;
|
||||
WORD wRightMotorIntensity;
|
||||
} XINPUT_VIBRATION, *PXINPUT_VIBRATION;
|
||||
|
||||
/*
|
||||
|
@ -5363,8 +5363,8 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
|
||||
* error.
|
||||
*
|
||||
* @param[in] jid The [joystick](@ref joysticks) to vibrate.
|
||||
* @param[in] slowMotorSpeed The low frequency rumble intensity.
|
||||
* @param[in] fastMotorSpeed The high frequency rumble intensity.
|
||||
* @param[in] slowMotorIntensity The low frequency rumble intensity.
|
||||
* @param[in] fastMotorIntensity The high frequency rumble intensity.
|
||||
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is
|
||||
* connected, or the joystick does not support the rumble effect.
|
||||
*
|
||||
@ -5373,13 +5373,16 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
|
||||
*
|
||||
* @thread_safety This function must only be called from the main thread.
|
||||
*
|
||||
* @note @win32 This function is only implemented for XInput devices.
|
||||
* @note @macos This function is not implemented.
|
||||
*
|
||||
* @sa @ref gamepad
|
||||
* @sa @ref glfwUpdateGamepadMappings
|
||||
* @sa @ref glfwJoystickIsGamepad
|
||||
*
|
||||
* @ingroup input
|
||||
*/
|
||||
GLFWAPI int glfwSetJoystickRumble(int jid, float slowMotorSpeed, float fastMotorSpeed);
|
||||
GLFWAPI int glfwSetJoystickRumble(int jid, float slowMotorIntensity, float fastMotorIntensity);
|
||||
|
||||
/*! @brief Sets the clipboard to the specified string.
|
||||
*
|
||||
|
@ -485,7 +485,7 @@ void _glfwPlatformUpdateGamepadGUID(char* guid)
|
||||
}
|
||||
}
|
||||
|
||||
int _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorSpeed, float fastMotorSpeed)
|
||||
int _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorIntensity, float fastMotorIntensity)
|
||||
{
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
12
src/input.c
12
src/input.c
@ -1312,7 +1312,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state)
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
GLFWAPI int glfwSetJoystickRumble(int jid, float slowMotorSpeed, float fastMotorSpeed)
|
||||
GLFWAPI int glfwSetJoystickRumble(int jid, float slowMotorIntensity, float fastMotorIntensity)
|
||||
{
|
||||
_GLFWjoystick* js;
|
||||
|
||||
@ -1331,13 +1331,13 @@ GLFWAPI int glfwSetJoystickRumble(int jid, float slowMotorSpeed, float fastMotor
|
||||
if (!js->present)
|
||||
return GLFW_FALSE;
|
||||
|
||||
slowMotorSpeed = slowMotorSpeed < 0.0f ? 0.0f : slowMotorSpeed;
|
||||
slowMotorSpeed = slowMotorSpeed > 1.0f ? 1.0f : slowMotorSpeed;
|
||||
slowMotorIntensity = slowMotorIntensity < 0.0f ? 0.0f : slowMotorIntensity;
|
||||
slowMotorIntensity = slowMotorIntensity > 1.0f ? 1.0f : slowMotorIntensity;
|
||||
|
||||
fastMotorSpeed = fastMotorSpeed < 0.0f ? 0.0f : fastMotorSpeed;
|
||||
fastMotorSpeed = fastMotorSpeed > 1.0f ? 1.0f : fastMotorSpeed;
|
||||
fastMotorIntensity = fastMotorIntensity < 0.0f ? 0.0f : fastMotorIntensity;
|
||||
fastMotorIntensity = fastMotorIntensity > 1.0f ? 1.0f : fastMotorIntensity;
|
||||
|
||||
return _glfwPlatformSetJoystickRumble(js, slowMotorSpeed, fastMotorSpeed);
|
||||
return _glfwPlatformSetJoystickRumble(js, slowMotorIntensity, fastMotorIntensity);
|
||||
}
|
||||
|
||||
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 _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorSpeed, float fastMotorSpeed);
|
||||
int _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorIntensity, float fastMotorIntensity);
|
||||
|
||||
uint64_t _glfwPlatformGetTimerValue(void);
|
||||
uint64_t _glfwPlatformGetTimerFrequency(void);
|
||||
|
@ -478,7 +478,7 @@ void _glfwPlatformUpdateGamepadGUID(char* guid)
|
||||
}
|
||||
|
||||
|
||||
int _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorSpeed, float fastMotorSpeed)
|
||||
int _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorIntensity, float fastMotorIntensity)
|
||||
{
|
||||
_GLFWjoystickLinux *linjs = &js->linjs;
|
||||
|
||||
@ -487,8 +487,8 @@ int _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorSpeed, floa
|
||||
|
||||
js->linjs.rumble->u.rumble = (struct ff_rumble_effect)
|
||||
{
|
||||
.strong_magnitude = 65535 * slowMotorSpeed,
|
||||
.weak_magnitude = 65535 * fastMotorSpeed
|
||||
.strong_magnitude = 65535 * slowMotorIntensity,
|
||||
.weak_magnitude = 65535 * fastMotorIntensity
|
||||
};
|
||||
|
||||
struct input_event play =
|
||||
|
@ -42,7 +42,7 @@ void _glfwPlatformUpdateGamepadGUID(char* guid)
|
||||
{
|
||||
}
|
||||
|
||||
int _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorSpeed, float fastMotorSpeed)
|
||||
int _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorIntensity, float fastMotorIntensity)
|
||||
{
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
@ -753,7 +753,7 @@ void _glfwPlatformUpdateGamepadGUID(char* guid)
|
||||
}
|
||||
}
|
||||
|
||||
int _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorSpeed, float fastMotorSpeed)
|
||||
int _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorIntensity, float fastMotorIntensity)
|
||||
{
|
||||
if (js->win32.device)
|
||||
return GLFW_FALSE;
|
||||
@ -761,8 +761,8 @@ int _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorSpeed, floa
|
||||
XINPUT_VIBRATION effect;
|
||||
ZeroMemory(&effect, sizeof(XINPUT_VIBRATION));
|
||||
|
||||
effect.wLeftMotorSpeed = (WORD)(65535.0f * slowMotorSpeed);
|
||||
effect.wRightMotorSpeed = (WORD)(65535.0f * fastMotorSpeed);
|
||||
effect.wLeftMotorIntensity = (WORD)(65535.0f * slowMotorIntensity);
|
||||
effect.wRightMotorIntensity = (WORD)(65535.0f * fastMotorIntensity);
|
||||
|
||||
return (int) (XInputSetState(js->win32.index, &effect) == ERROR_SUCCESS);
|
||||
}
|
Loading…
Reference in New Issue
Block a user