sdlGetGamepadSerial function

String? sdlGetGamepadSerial(
  1. Pointer<SdlGamepad> gamepad
)

Get the serial number of an opened gamepad, if available.

Returns the serial number of the gamepad, or NULL if it is not available.

\param gamepad the gamepad object to query. \returns the serial number, or NULL if unavailable.

\since This function is available since SDL 3.1.3.

extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadSerial(SDL_Gamepad *gamepad)

Implementation

String? sdlGetGamepadSerial(Pointer<SdlGamepad> gamepad) {
  final sdlGetGamepadSerialLookupFunction = libSdl3.lookupFunction<
      Pointer<Utf8> Function(Pointer<SdlGamepad> gamepad),
      Pointer<Utf8> Function(
          Pointer<SdlGamepad> gamepad)>('SDL_GetGamepadSerial');
  final result = sdlGetGamepadSerialLookupFunction(gamepad);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}