Fixed POV handling on Linux

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1339 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-01-09 09:13:06 +00:00
parent 44c943e651
commit 489ee2b17b

View File

@ -122,22 +122,22 @@ JoystickState Joystick::UpdateState()
break;
// Compute the new POV angle
if (myPovX == 1)
if (myPovX > 0)
{
if (myPovY == 1) myState.Axis[Joy::AxisPOV] = 315.f;
else if (myPovY == -1) myState.Axis[Joy::AxisPOV] = 45.f;
if (myPovY > 0) myState.Axis[Joy::AxisPOV] = 315.f;
else if (myPovY < 0) myState.Axis[Joy::AxisPOV] = 45.f;
else myState.Axis[Joy::AxisPOV] = 0.f;
}
else if (myPovX == -1)
else if (myPovX < 0)
{
if (myPovY == 1) myState.Axis[Joy::AxisPOV] = 225.f;
else if (myPovY == -1) myState.Axis[Joy::AxisPOV] = 135.f;
if (myPovY > 0) myState.Axis[Joy::AxisPOV] = 225.f;
else if (myPovY < 0) myState.Axis[Joy::AxisPOV] = 135.f;
else myState.Axis[Joy::AxisPOV] = 180.f;
}
else
{
if (myPovY == 1) myState.Axis[Joy::AxisPOV] = 270.f;
else if (myPovY == -1) myState.Axis[Joy::AxisPOV] = 90.f;
if (myPovY > 0) myState.Axis[Joy::AxisPOV] = 270.f;
else if (myPovY < 0) myState.Axis[Joy::AxisPOV] = 90.f;
else myState.Axis[Joy::AxisPOV] = -1.f;
}
}