Win32: Remove deadzone logic from XInput path

Related to #1021.
Related to #1045.
This commit is contained in:
Camilla Löwy 2017-08-03 02:11:32 +02:00
parent a397195d3f
commit 75e44abf09
2 changed files with 7 additions and 27 deletions

View File

@ -173,6 +173,7 @@ information on what to include when reporting a bug.
- Bugfix: The scancode for synthetic key release events was always zero - Bugfix: The scancode for synthetic key release events was always zero
- [Win32] Added system error strings to relevant GLFW error descriptions (#733) - [Win32] Added system error strings to relevant GLFW error descriptions (#733)
- [Win32] Moved to `WM_INPUT` for disabled cursor mode motion input (#125) - [Win32] Moved to `WM_INPUT` for disabled cursor mode motion input (#125)
- [Win32] Removed XInput circular deadzone from joystick axis data (#1045)
- [Win32] Bugfix: Undecorated windows could not be iconified by the user (#861) - [Win32] Bugfix: Undecorated windows could not be iconified by the user (#861)
- [Win32] Bugfix: Deadzone logic could underflow with some controllers (#910) - [Win32] Bugfix: Deadzone logic could underflow with some controllers (#910)
- [Win32] Bugfix: Bitness test in `FindVulkan.cmake` was VS specific (#928) - [Win32] Bugfix: Bitness test in `FindVulkan.cmake` was VS specific (#928)

View File

@ -675,7 +675,6 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
int i, dpad = 0; int i, dpad = 0;
DWORD result; DWORD result;
XINPUT_STATE xis; XINPUT_STATE xis;
float axes[6] = { 0.f, 0.f, 0.f, 0.f, -1.f, -1.f };
const WORD buttons[10] = const WORD buttons[10] =
{ {
XINPUT_GAMEPAD_A, XINPUT_GAMEPAD_A,
@ -702,32 +701,12 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
if (mode == _GLFW_POLL_PRESENCE) if (mode == _GLFW_POLL_PRESENCE)
return GLFW_TRUE; return GLFW_TRUE;
if ((float) xis.Gamepad.sThumbLX * xis.Gamepad.sThumbLX + _glfwInputJoystickAxis(js, 0, (xis.Gamepad.sThumbLX + 0.5f) / 32767.f);
(float) xis.Gamepad.sThumbLY * xis.Gamepad.sThumbLY > _glfwInputJoystickAxis(js, 1, (xis.Gamepad.sThumbLY + 0.5f) / 32767.f);
(float) XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE * _glfwInputJoystickAxis(js, 2, (xis.Gamepad.sThumbRX + 0.5f) / 32767.f);
XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE) _glfwInputJoystickAxis(js, 3, (xis.Gamepad.sThumbRY + 0.5f) / 32767.f);
{ _glfwInputJoystickAxis(js, 4, xis.Gamepad.bLeftTrigger / 127.5f - 1.f);
axes[0] = (xis.Gamepad.sThumbLX + 0.5f) / 32767.f; _glfwInputJoystickAxis(js, 5, xis.Gamepad.bRightTrigger / 127.5f - 1.f);
axes[1] = (xis.Gamepad.sThumbLY + 0.5f) / 32767.f;
}
if ((float) xis.Gamepad.sThumbRX * xis.Gamepad.sThumbRX +
(float) xis.Gamepad.sThumbRY * xis.Gamepad.sThumbRY >
(float) XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE *
XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE)
{
axes[2] = (xis.Gamepad.sThumbRX + 0.5f) / 32767.f;
axes[3] = (xis.Gamepad.sThumbRY + 0.5f) / 32767.f;
}
if (xis.Gamepad.bLeftTrigger > XINPUT_GAMEPAD_TRIGGER_THRESHOLD)
axes[4] = xis.Gamepad.bLeftTrigger / 127.5f - 1.f;
if (xis.Gamepad.bRightTrigger > XINPUT_GAMEPAD_TRIGGER_THRESHOLD)
axes[5] = xis.Gamepad.bRightTrigger / 127.5f - 1.f;
for (i = 0; i < 6; i++)
_glfwInputJoystickAxis(js, i, axes[i]);
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
{ {