GamepadsSDL 3.2

SDL_CloseGamepad

Closes a gamepad you opened, e.g. when it is unplugged.

Signature

void SDL_CloseGamepad(SDL_Gamepad *gamepad);

How it works

After SDL_EVENT_GAMEPAD_REMOVED the pointer is useless: close it and forget it. Pads still open at the end are closed by SDL_Quit.

Parameters

gamepadSDL_Gamepad *

The gamepad to close.

Example

example.cpp
1SDL_CloseGamepad(pad);
2pad = nullptr;
Official SDL wiki