offalynne / Input

Comprehensive cross-platform input for GameMaker
https://offalynne.github.io/Input
MIT License
255 stars 34 forks source link

Inconsistent detection of gamepad status #887

Closed ABNTGeneric closed 2 hours ago

ABNTGeneric commented 2 hours ago

GAMEMAKER The function 'input_player_using_gamepad' returns true while the function 'input_player_get_gamepad' still returns -1. This happens when the code is run on the same frame as the async "gamepad connected" event. I'm using standard xInput and PS4 controllers and the function input_player_get_gamepad otherwise returns the proper index.

ABNTGeneric commented 2 hours ago

Turns out, 'input_player_using_gamepad' does not account for the gamepad being disconnected. It only checks to see if the last connected source was a gamepad. For code like this to work, you must also run a check to see if the source is connected using 'input_player_connected'

offalynne commented 1 hour ago

Will add a note to the docs to reflect this, thanks for following up with your final findings