sdlGetHapticNameForId function

String? sdlGetHapticNameForId(
  1. int instanceId
)

Get the implementation dependent name of a haptic device.

This can be called before any haptic devices are opened.

\param instance_id the haptic device instance ID. \returns the name of the selected haptic device. If no name can be found, this function returns NULL; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

\sa SDL_GetHapticName \sa SDL_OpenHaptic

extern SDL_DECLSPEC const char * SDLCALL SDL_GetHapticNameForID(SDL_HapticID instance_id)

Implementation

String? sdlGetHapticNameForId(int instanceId) {
  final sdlGetHapticNameForIdLookupFunction = libSdl3.lookupFunction<
      Pointer<Utf8> Function(Uint32 instanceId),
      Pointer<Utf8> Function(int instanceId)>('SDL_GetHapticNameForID');
  final result = sdlGetHapticNameForIdLookupFunction(instanceId);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}