Initial support for hotplugging mice and keyboards

This commit is contained in:
Sam Lantinga
2024-03-20 06:58:00 -07:00
parent c33e4c998d
commit 2fe1a6a279
44 changed files with 961 additions and 321 deletions

View File

@@ -682,6 +682,25 @@ SDL_bool SDL_JoystickHandledByAnotherDriver(struct SDL_JoystickDriver *driver, U
return result;
}
SDL_bool SDL_HasJoystick(void)
{
int i;
int total_joysticks = 0;
SDL_LockJoysticks();
{
for (i = 0; i < SDL_arraysize(SDL_joystick_drivers); ++i) {
total_joysticks += SDL_joystick_drivers[i]->GetCount();
}
}
SDL_UnlockJoysticks();
if (total_joysticks > 0) {
return SDL_TRUE;
}
return SDL_FALSE;
}
SDL_JoystickID *SDL_GetJoysticks(int *count)
{
int i, num_joysticks, device_index;