sdlGameControllerGetSerial function

String? sdlGameControllerGetSerial(
  1. Pointer<SdlGameController> gamecontroller
)

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

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

\param gamecontroller the game controller object to query. \return the serial number, or NULL if unavailable.

\since This function is available since SDL 2.0.14.

extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameController *gamecontroller)

Implementation

String? sdlGameControllerGetSerial(Pointer<SdlGameController> gamecontroller) {
  final sdlGameControllerGetSerialLookupFunction = libSdl2.lookupFunction<
          Pointer<Utf8> Function(Pointer<SdlGameController> gamecontroller),
          Pointer<Utf8> Function(Pointer<SdlGameController> gamecontroller)>(
      'SDL_GameControllerGetSerial');
  final result = sdlGameControllerGetSerialLookupFunction(gamecontroller);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}