sdlGetGamepadStringForType function gamepad
Convert from an SDL_GamepadType enum to a string.
\param type an enum value for a given SDL_GamepadType. \returns a string for the given type, or NULL if an invalid type is specified. The string returned is of the format used by SDL_Gamepad mapping strings.
\threadsafety It is safe to call this function from any thread.
\since This function is available since SDL 3.2.0.
\sa SDL_GetGamepadTypeFromString
extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadStringForType(SDL_GamepadType type)
Implementation
String? sdlGetGamepadStringForType(int type) {
final sdlGetGamepadStringForTypeLookupFunction = _libSdl
.lookupFunction<
Pointer<Utf8> Function(Int32 type),
Pointer<Utf8> Function(int type)
>('SDL_GetGamepadStringForType');
final result = sdlGetGamepadStringForTypeLookupFunction(type);
if (result == nullptr) {
return null;
}
return result.toDartString();
}