Merge branch 'glfw_fix_invalid_gamepad_axis_ranges' of https://github.com/Luflosi/kitty

This commit is contained in:
Kovid Goyal 2019-07-27 08:20:02 +05:30
commit 14fb7c3201
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

4
glfw/input.c vendored
View File

@ -1365,9 +1365,11 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state)
const unsigned int bit = e->index & 0xf;
if (js->hats[hat] & bit)
state->axes[i] = 1.f;
else
state->axes[i] = -1.f;
}
else if (e->type == _GLFW_JOYSTICK_BUTTON)
state->axes[i] = (float) js->buttons[e->index];
state->axes[i] = js->buttons[e->index] * 2.f - 1.f;
}
return true;