I tried to use SDL_JoystickOpened()
in a SDL-2.0 code, but I got the error message SDL_JoystickOpened
was not declared in this scope.
I've searched and found that SDL_JoystickOpened()
no longer exists in SDL-2.0, but I didn't find the function that replaced it. Can anyone please tell me how can I replace SDL_JoystickOpened()
in this piece of code:
SDL_Joystick *joy = SDL_JoystickOpen(0);
if (SDL_JoystickOpened(0) == 1)
{
// do something
}
Thanks.
The documentation says the SDL_JoystickOpen()
call returns a NULL pointer if it fails so just do a check for that:
SDL_Joystick *joy = SDL_JoystickOpen(0);
if (joy) {
// joy is a valid pointer so do stuff
}