Fixed wrong joystick POV values in the Linux implementation

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1341 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2010-01-09 17:24:51 +00:00
parent 489ee2b17b
commit 8df50b9774

View File

@ -119,29 +119,29 @@ JoystickState Joystick::UpdateState()
case ABS_HAT0Y : myPovY = JoyState.value; break; case ABS_HAT0Y : myPovY = JoyState.value; break;
default : break; default : break;
} }
break;
// Compute the new POV angle // Compute the new POV angle
if (myPovX > 0) if (myPovX > 0)
{ {
if (myPovY > 0) myState.Axis[Joy::AxisPOV] = 315.f; if (myPovY > 0) myState.Axis[Joy::AxisPOV] = 135.f;
else if (myPovY < 0) myState.Axis[Joy::AxisPOV] = 45.f; else if (myPovY < 0) myState.Axis[Joy::AxisPOV] = 45.f;
else myState.Axis[Joy::AxisPOV] = 0.f; else myState.Axis[Joy::AxisPOV] = 90.f;
} }
else if (myPovX < 0) else if (myPovX < 0)
{ {
if (myPovY > 0) myState.Axis[Joy::AxisPOV] = 225.f; if (myPovY > 0) myState.Axis[Joy::AxisPOV] = 225.f;
else if (myPovY < 0) myState.Axis[Joy::AxisPOV] = 135.f; else if (myPovY < 0) myState.Axis[Joy::AxisPOV] = 315.f;
else myState.Axis[Joy::AxisPOV] = 180.f; else myState.Axis[Joy::AxisPOV] = 270.f;
} }
else else
{ {
if (myPovY > 0) myState.Axis[Joy::AxisPOV] = 270.f; if (myPovY > 0) myState.Axis[Joy::AxisPOV] = 180.f;
else if (myPovY < 0) myState.Axis[Joy::AxisPOV] = 90.f; else if (myPovY < 0) myState.Axis[Joy::AxisPOV] = 0.f;
else myState.Axis[Joy::AxisPOV] = -1.f; else myState.Axis[Joy::AxisPOV] = -1.f;
} }
break;
} }
// A button has been pressed // A button has been pressed
case JS_EVENT_BUTTON : case JS_EVENT_BUTTON :
{ {