fix: set correct default axes for gamepads that are not connected
`glfwGetGamepadState` will set all gamepad state variables to 0.0 if required gamepad is not connected, but `RecordAutomationEvent()` inside rcore.c expects trigger axes to be -1.0f when gamepad is not connected. Since SDL and RGFW return -1.0f in such case, this change is aligning it with them
This commit is contained in:
parent
101502103a
commit
c4531302ee
|
|
@ -1266,8 +1266,14 @@ void PollInputEvents(void)
|
|||
// Get current gamepad state
|
||||
// NOTE: There is no callback available, so we get it manually
|
||||
GLFWgamepadstate state = { 0 };
|
||||
glfwGetGamepadState(i, &state); // This remapps all gamepads so they have their buttons mapped like an xbox controller
|
||||
|
||||
int isGamepadConnected = glfwGetGamepadState(i, &state); // This remapps all gamepads so they have their buttons mapped like an xbox controller
|
||||
if (!isGamepadConnected)
|
||||
{
|
||||
// setting axes to expected value instead of GLFW's 0.0f default when gamepad isnt connected
|
||||
state.axes[GAMEPAD_AXIS_LEFT_TRIGGER] = -1.0f;
|
||||
state.axes[GAMEPAD_AXIS_RIGHT_TRIGGER] = -1.0f;
|
||||
}
|
||||
|
||||
const unsigned char *buttons = state.buttons;
|
||||
|
||||
for (int k = 0; (buttons != NULL) && (k < MAX_GAMEPAD_BUTTONS); k++)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user