Add joystick count function

This commit is contained in:
thesource 2024-10-30 08:43:50 +03:00
parent 7e94363060
commit 8d112ac6c8
2 changed files with 10 additions and 0 deletions

View File

@ -547,6 +547,15 @@ int get_joystick_number_by_id(SDL_JoystickID id)
return -1;
}
int get_number_of_joysticks()
{
int i, n=0;
for(i=0; i<MAX_JOYSTICKS; ++i)
if(open_joysticks[i].first)
++n;
return n;
}
static u16 shift_pressed;
void

View File

@ -119,5 +119,6 @@ void
process_joystick_device_events();
int get_joystick_number_by_id(SDL_JoystickID id);
int get_number_of_joysticks();
#endif /* CTRLSSDL_H */