Merge pull request #245 from rcmagic/patch-1

Fixed bug in the Windows joystick handling converting POV hat angles to their PovX and PovY component axes.
This commit is contained in:
Laurent Gomila 2012-07-01 13:44:34 -07:00
commit 3c0de3e00e

View File

@ -139,7 +139,7 @@ JoystickState JoystickImpl::update()
// Special case for POV, it is given as an angle // Special case for POV, it is given as an angle
if (pos.dwPOV != 0xFFFF) if (pos.dwPOV != 0xFFFF)
{ {
float angle = pos.dwPOV / 36000.f * 3.141592654f; float angle = pos.dwPOV / 18000.f * 3.141592654f;
state.axes[Joystick::PovX] = std::cos(angle) * 100; state.axes[Joystick::PovX] = std::cos(angle) * 100;
state.axes[Joystick::PovY] = std::sin(angle) * 100; state.axes[Joystick::PovY] = std::sin(angle) * 100;
} }