toGameControllerAxis method

GameControllerAxis toGameControllerAxis(
  1. Sdl sdl
)

Convert to a game controller axis.

SDL Docs

Implementation

GameControllerAxis toGameControllerAxis(final Sdl sdl) {
  final ptr = toCharPointer();
  final i = sdl.sdl.SDL_GameControllerGetAxisFromString(ptr);
  malloc.free(ptr);
  final v = i.toGameControllerAxis();
  if (v == GameControllerAxis.invalid) {
    throw SdlError(0, 'Invalid axis string "$this".');
  }
  return v;
}