sdlHapticName function

String? sdlHapticName(
  1. int deviceIndex
)

Get the implementation dependent name of a haptic device.

This can be called before any joysticks are opened. If no name can be found, this function returns NULL.

\param device_index index of the device to query. \returns the name of the device or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_NumHaptics

extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index)

Implementation

String? sdlHapticName(int deviceIndex) {
  final sdlHapticNameLookupFunction = libSdl2.lookupFunction<
      Pointer<Utf8> Function(Int32 deviceIndex),
      Pointer<Utf8> Function(int deviceIndex)>('SDL_HapticName');
  final result = sdlHapticNameLookupFunction(deviceIndex);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}