I guess I know the root of the problem. This is a proposed fix if you want to try (though its only based on your description above, not on actual knowledge of the used joystick functions):
diff --git a/src/SFML/Window/Win32/JoystickImpl.cpp b/src/SFML/Window/Win32/JoystickImpl.cpp
index c2645e8..7f2bec2 100644
--- a/src/SFML/Window/Win32/JoystickImpl.cpp
+++ b/src/SFML/Window/Win32/JoystickImpl.cpp
@@ -167,8 +167,8 @@ JoystickState JoystickImpl::update()
if (pos.dwPOV != 0xFFFF)
{
float angle = pos.dwPOV / 18000.f * 3.141592654f;
- state.axes[Joystick::PovX] = std::cos(angle) * 100;
- state.axes[Joystick::PovY] = std::sin(angle) * 100;
+ state.axes[Joystick::PovX] = std::sin(angle) * 100;
+ state.axes[Joystick::PovY] = std::cos(angle) * 100;
}
else
{
There is no doc explaining how to interpret the angle (where is "0", is it clockwise or counter clockwise).
Actually I just looked at this again and there is what we need. Take a look at the remarks section near the bottom (of the article I linked above).
Most devices with a point-of-view control have only five positions. When the JOY_RETURNPOV flag is set, these positions are reported by using the following constants:
So according to this we should set that flag in the initialize function...
joyInfo.dwFlags = JOY_RETURNPOV;
Then the returned angle should be constrained to the following quote. And as you can see 0 degrees is up/forward while 90 degrees is to the right. Therefore switching the sin/cos calls around should fix the issue.
JOY_POVBACKWARD Point-of-view hat is pressed backward. The value 18,000 represents an orientation of 180.00 degrees (to the rear).
JOY_POVCENTERED Point-of-view hat is in the neutral position. The value -1 means the point-of-view hat has no angle to report.
JOY_POVFORWARD Point-of-view hat is pressed forward. The value 0 represents an orientation of 0.00 degrees (straight ahead).
JOY_POVLEFT Point-of-view hat is being pressed to the left. The value 27,000 represents an orientation of 270.00 degrees (90.00 degrees to the left).
JOY_POVRIGHT Point-of-view hat is pressed to the right. The value 9,000 represents an orientation of 90.00 degrees (to the right).