Hello,
I recently bought a gamepad to test a code with my project.
The gamepad is seen as a “Retrolink SNES Controller” (GUID:03000000790000001100000010010000).
The bug is the UP and LEFT keys. They are not detected properly. I dig in the code and found out that to know if one button is pressed on the pad was to test if the value is over 0.0f, but this is only correct with DOWN and RIGHT on that kind of device.
So I modify “input.c” at 1260
const float value = js->axes[e->index] * e->axisScale + e->axisOffset;
if (value > 0.f)
state->buttons[i] = GLFW_PRESS;
By :
const float value = js->axes[e->index] * e->axisScale + e->axisOffset;
if ( e->axisOffset < 0 )
{
if (value > 0.f)
state->buttons[i] = GLFW_PRESS;
}
else
{
if (value < 0.f)
state->buttons[i] = GLFW_PRESS;
}
Now it works. But the code breaks obviously others gamepads because there are not working the same way with the directional pad. I don’t know really what to do, but here is a bug.