sdlJoystickPathForIndex function

String? sdlJoystickPathForIndex(
  1. int deviceIndex
)

Get the implementation dependent path of a joystick.

This can be called before any joysticks are opened.

\param device_index the index of the joystick to query (the N'th joystick on the system) \returns the path of the selected joystick. If no path can be found, this function returns NULL; call SDL_GetError() for more information.

\since This function is available since SDL 2.24.0.

\sa SDL_JoystickPath \sa SDL_JoystickOpen

extern DECLSPEC const char *SDLCALL SDL_JoystickPathForIndex(int device_index)

Implementation

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