sdlJoystickName function

String? sdlJoystickName(
  1. Pointer<SdlJoystick> joystick
)

Get the implementation dependent name of a joystick.

\param joystick the SDL_Joystick obtained from SDL_JoystickOpen() \returns the name of the selected joystick. If no name can be found, this function returns NULL; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_JoystickNameForIndex \sa SDL_JoystickOpen

extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick *joystick)

Implementation

String? sdlJoystickName(Pointer<SdlJoystick> joystick) {
  final sdlJoystickNameLookupFunction = libSdl2.lookupFunction<
      Pointer<Utf8> Function(Pointer<SdlJoystick> joystick),
      Pointer<Utf8> Function(
          Pointer<SdlJoystick> joystick)>('SDL_JoystickName');
  final result = sdlJoystickNameLookupFunction(joystick);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}