sdlGameControllerGetStringForAxis function

String? sdlGameControllerGetStringForAxis(
  1. int axis
)

Convert from an SDL_GameControllerAxis enum to a string.

The caller should not SDL_free() the returned string.

\param axis an enum value for a given SDL_GameControllerAxis \returns a string for the given axis, or NULL if an invalid axis is specified. The string returned is of the format used by SDL_GameController mapping strings.

\since This function is available since SDL 2.0.0.

\sa SDL_GameControllerGetAxisFromString

extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis)

Implementation

String? sdlGameControllerGetStringForAxis(int axis) {
  final sdlGameControllerGetStringForAxisLookupFunction =
      libSdl2.lookupFunction<
          Pointer<Utf8> Function(Int32 axis),
          Pointer<Utf8> Function(
              int axis)>('SDL_GameControllerGetStringForAxis');
  final result = sdlGameControllerGetStringForAxisLookupFunction(axis);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}