mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 21:14:35 +00:00
Cleanup
This commit is contained in:
parent
463ef7eb71
commit
90e22947c6
@ -406,12 +406,12 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
|
|||||||
if (raw > axis->maximum)
|
if (raw > axis->maximum)
|
||||||
axis->maximum = raw;
|
axis->maximum = raw;
|
||||||
|
|
||||||
const long delta = axis->maximum - axis->minimum;
|
const long size = axis->maximum - axis->minimum;
|
||||||
if (delta == 0)
|
if (size == 0)
|
||||||
_glfwInputJoystickAxis(js, (int) i, 0.f);
|
_glfwInputJoystickAxis(js, (int) i, 0.f);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const float value = (2.f * (raw - axis->minimum) / delta) - 1.f;
|
const float value = (2.f * (raw - axis->minimum) / size) - 1.f;
|
||||||
_glfwInputJoystickAxis(js, (int) i, value);
|
_glfwInputJoystickAxis(js, (int) i, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user