Question

I'm trying to get the value from the thumbstick with XInput, but the values are weird and I don't know how to handle them correctly.

How do I calculate so that I can read the values between -1 (thumbstick to the left/up) +1 (thumbstick to the right/down)

Similiar to XNA's Gamepad.GetState().ThumbSticks.Left.X ( -1 = to the left, +1 = to the right ).

Any ideas?

Was it helpful?

Solution

According to the documentation, _XINPUT_GAMEPAD.sThumbLX is a SHORT whose value lies between -32768 and 32767. If you want to convert that to a range of [-1, 1), divide the value by 32768.0.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top