sdlxGetGamepadMappingForId function gamepad
Get the mapping of a gamepad.
This can be called before any gamepads are opened.
\param instance_id the joystick instance ID. \returns the mapping string. Returns NULL if no mapping is available. This should be freed with SDL_free() when it is no longer needed.
\threadsafety It is safe to call this function from any thread.
\since This function is available since SDL 3.2.0.
\sa SDL_GetGamepads \sa SDL_GetGamepadMapping
extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMappingForID(SDL_JoystickID instance_id)
Implementation
String? sdlxGetGamepadMappingForId(int instanceId) {
String? result;
final stringPointer = sdlGetGamepadMappingForId(instanceId);
if (stringPointer != nullptr) {
result = stringPointer.cast<Utf8>().toDartString();
sdlFree(stringPointer.cast<Void>());
}
return result;
}