From 8df50b9774026b7c59bfd871ebc4813bd2d93c45 Mon Sep 17 00:00:00 2001 From: LaurentGom Date: Sat, 9 Jan 2010 17:24:51 +0000 Subject: [PATCH] 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 --- src/SFML/Window/Linux/Joystick.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/SFML/Window/Linux/Joystick.cpp b/src/SFML/Window/Linux/Joystick.cpp index 6052cc914..829a74151 100644 --- a/src/SFML/Window/Linux/Joystick.cpp +++ b/src/SFML/Window/Linux/Joystick.cpp @@ -119,29 +119,29 @@ JoystickState Joystick::UpdateState() case ABS_HAT0Y : myPovY = JoyState.value; break; default : break; } - break; // Compute the new POV angle 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 myState.Axis[Joy::AxisPOV] = 0.f; + else myState.Axis[Joy::AxisPOV] = 90.f; } else if (myPovX < 0) { 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 < 0) myState.Axis[Joy::AxisPOV] = 315.f; + else myState.Axis[Joy::AxisPOV] = 270.f; } else { - if (myPovY > 0) myState.Axis[Joy::AxisPOV] = 270.f; - else if (myPovY < 0) myState.Axis[Joy::AxisPOV] = 90.f; + if (myPovY > 0) myState.Axis[Joy::AxisPOV] = 180.f; + else if (myPovY < 0) myState.Axis[Joy::AxisPOV] = 0.f; else myState.Axis[Joy::AxisPOV] = -1.f; } + break; } - + // A button has been pressed case JS_EVENT_BUTTON : {