Removed SDL_HasGamepads(), SDL_HasJoysticks(), and SDL_HasSensors()

Also cleaned up logic for whether we need to poll for events:
- We need to periodically poll for joysticks to handle hotplug.
- We need to frequently poll for joysticks and sensors when they're open so their state can be updated
This commit is contained in:
Sam Lantinga 2022-12-29 23:07:30 -08:00
parent 7f23d71b6a
commit 324c0b76a0
15 changed files with 64 additions and 153 deletions

View file

@ -1914,23 +1914,6 @@ int SDL_InitGamepads(void)
return 0;
}
SDL_bool SDL_HasGamepads(void)
{
SDL_bool retval = SDL_FALSE;
SDL_JoystickID *joysticks = SDL_GetJoysticks(NULL);
if (joysticks) {
int i;
for (i = 0; joysticks[i]; ++i) {
if (SDL_IsGamepad(joysticks[i])) {
retval = SDL_TRUE;
break;
}
}
SDL_free(joysticks);
}
return retval;
}
SDL_JoystickID *SDL_GetGamepads(int *count)
{
int num_joysticks = 0;