mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 12:51:05 +08:00
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:
commit
3c0de3e00e
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user