From 489ee2b17baa2b643b907acd3269ae8a7e84033f Mon Sep 17 00:00:00 2001 From: LaurentGom Date: Sat, 9 Jan 2010 09:13:06 +0000 Subject: [PATCH] Fixed POV handling on Linux git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1339 4e206d99-4929-0410-ac5d-dfc041789085 --- src/SFML/Window/Linux/Joystick.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/SFML/Window/Linux/Joystick.cpp b/src/SFML/Window/Linux/Joystick.cpp index 4f3ca725..6052cc91 100644 --- a/src/SFML/Window/Linux/Joystick.cpp +++ b/src/SFML/Window/Linux/Joystick.cpp @@ -122,23 +122,23 @@ 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; - else myState.Axis[Joy::AxisPOV] = 0.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; - else myState.Axis[Joy::AxisPOV] = 180.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; - else myState.Axis[Joy::AxisPOV] = -1.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; } }