sdlGetHapticName function haptic

String? sdlGetHapticName(
  1. Pointer<SdlHaptic> haptic
)

Get the implementation dependent name of a haptic device.

\param haptic the SDL_Haptic obtained from SDL_OpenJoystick(). \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.2.0.

\sa SDL_GetHapticNameForID

extern SDL_DECLSPEC const char * SDLCALL SDL_GetHapticName(SDL_Haptic *haptic)

Implementation

String? sdlGetHapticName(Pointer<SdlHaptic> haptic) {
  final sdlGetHapticNameLookupFunction = _libSdl
      .lookupFunction<
        Pointer<Utf8> Function(Pointer<SdlHaptic> haptic),
        Pointer<Utf8> Function(Pointer<SdlHaptic> haptic)
      >('SDL_GetHapticName');
  final result = sdlGetHapticNameLookupFunction(haptic);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}