give parameters more sensible names

This commit is contained in:
Nikita Leonidov 2020-04-18 18:30:18 -04:00
parent 7734040b22
commit 7e7d8110fc
8 changed files with 23 additions and 20 deletions

4
deps/mingw/xinput.h vendored
View File

@ -182,8 +182,8 @@ typedef struct _XINPUT_STATE {
*/ */
typedef struct _XINPUT_VIBRATION { typedef struct _XINPUT_VIBRATION {
WORD wLeftMotorSpeed; WORD wLeftMotorIntensity;
WORD wRightMotorSpeed; WORD wRightMotorIntensity;
} XINPUT_VIBRATION, *PXINPUT_VIBRATION; } XINPUT_VIBRATION, *PXINPUT_VIBRATION;
/* /*

View File

@ -5363,8 +5363,8 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
* error. * error.
* *
* @param[in] jid The [joystick](@ref joysticks) to vibrate. * @param[in] jid The [joystick](@ref joysticks) to vibrate.
* @param[in] slowMotorSpeed The low frequency rumble intensity. * @param[in] slowMotorIntensity The low frequency rumble intensity.
* @param[in] fastMotorSpeed The high frequency rumble intensity. * @param[in] fastMotorIntensity The high frequency rumble intensity.
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is
* connected, or the joystick does not support the rumble effect. * 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. * @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 gamepad
* @sa @ref glfwUpdateGamepadMappings * @sa @ref glfwUpdateGamepadMappings
* @sa @ref glfwJoystickIsGamepad * @sa @ref glfwJoystickIsGamepad
* *
* @ingroup input * @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. /*! @brief Sets the clipboard to the specified string.
* *

View File

@ -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; return GLFW_FALSE;
} }

View File

@ -1312,7 +1312,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state)
return GLFW_TRUE; return GLFW_TRUE;
} }
GLFWAPI int glfwSetJoystickRumble(int jid, float slowMotorSpeed, float fastMotorSpeed) GLFWAPI int glfwSetJoystickRumble(int jid, float slowMotorIntensity, float fastMotorIntensity)
{ {
_GLFWjoystick* js; _GLFWjoystick* js;
@ -1331,13 +1331,13 @@ GLFWAPI int glfwSetJoystickRumble(int jid, float slowMotorSpeed, float fastMotor
if (!js->present) if (!js->present)
return GLFW_FALSE; return GLFW_FALSE;
slowMotorSpeed = slowMotorSpeed < 0.0f ? 0.0f : slowMotorSpeed; slowMotorIntensity = slowMotorIntensity < 0.0f ? 0.0f : slowMotorIntensity;
slowMotorSpeed = slowMotorSpeed > 1.0f ? 1.0f : slowMotorSpeed; slowMotorIntensity = slowMotorIntensity > 1.0f ? 1.0f : slowMotorIntensity;
fastMotorSpeed = fastMotorSpeed < 0.0f ? 0.0f : fastMotorSpeed; fastMotorIntensity = fastMotorIntensity < 0.0f ? 0.0f : fastMotorIntensity;
fastMotorSpeed = fastMotorSpeed > 1.0f ? 1.0f : fastMotorSpeed; 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) GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string)

View File

@ -628,7 +628,7 @@ const char* _glfwPlatformGetClipboardString(void);
int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode); int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode);
void _glfwPlatformUpdateGamepadGUID(char* guid); 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 _glfwPlatformGetTimerValue(void);
uint64_t _glfwPlatformGetTimerFrequency(void); uint64_t _glfwPlatformGetTimerFrequency(void);

View File

@ -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; _GLFWjoystickLinux *linjs = &js->linjs;
@ -487,8 +487,8 @@ int _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorSpeed, floa
js->linjs.rumble->u.rumble = (struct ff_rumble_effect) js->linjs.rumble->u.rumble = (struct ff_rumble_effect)
{ {
.strong_magnitude = 65535 * slowMotorSpeed, .strong_magnitude = 65535 * slowMotorIntensity,
.weak_magnitude = 65535 * fastMotorSpeed .weak_magnitude = 65535 * fastMotorIntensity
}; };
struct input_event play = struct input_event play =

View File

@ -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; return GLFW_FALSE;
} }

View File

@ -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) if (js->win32.device)
return GLFW_FALSE; return GLFW_FALSE;
@ -761,8 +761,8 @@ int _glfwPlatformSetJoystickRumble(_GLFWjoystick* js, float slowMotorSpeed, floa
XINPUT_VIBRATION effect; XINPUT_VIBRATION effect;
ZeroMemory(&effect, sizeof(XINPUT_VIBRATION)); ZeroMemory(&effect, sizeof(XINPUT_VIBRATION));
effect.wLeftMotorSpeed = (WORD)(65535.0f * slowMotorSpeed); effect.wLeftMotorIntensity = (WORD)(65535.0f * slowMotorIntensity);
effect.wRightMotorSpeed = (WORD)(65535.0f * fastMotorSpeed); effect.wRightMotorIntensity = (WORD)(65535.0f * fastMotorIntensity);
return (int) (XInputSetState(js->win32.index, &effect) == ERROR_SUCCESS); return (int) (XInputSetState(js->win32.index, &effect) == ERROR_SUCCESS);
} }