sdlGetGamepadName function
Get the implementation-dependent name for an opened gamepad.
\param gamepad a gamepad identifier previously returned by SDL_OpenGamepad(). \returns the implementation dependent name for the gamepad, or NULL if there is no name or the identifier passed is invalid.
\since This function is available since SDL 3.1.3.
\sa SDL_GetGamepadNameForID
extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadName(SDL_Gamepad *gamepad)
Implementation
String? sdlGetGamepadName(Pointer<SdlGamepad> gamepad) {
final sdlGetGamepadNameLookupFunction = libSdl3.lookupFunction<
Pointer<Utf8> Function(Pointer<SdlGamepad> gamepad),
Pointer<Utf8> Function(
Pointer<SdlGamepad> gamepad)>('SDL_GetGamepadName');
final result = sdlGetGamepadNameLookupFunction(gamepad);
if (result == nullptr) {
return null;
}
return result.toDartString();
}