sdlGamepadHasAxis function

bool sdlGamepadHasAxis(
  1. Pointer<SdlGamepad> gamepad,
  2. int axis
)

Query whether a gamepad has a given axis.

This merely reports whether the gamepad's mapping defined this axis, as that is all the information SDL has about the physical device.

\param gamepad a gamepad. \param axis an axis enum value (an SDL_GamepadAxis value). \returns true if the gamepad has this axis, false otherwise.

\since This function is available since SDL 3.1.3.

\sa SDL_GamepadHasButton \sa SDL_GetGamepadAxis

extern SDL_DECLSPEC bool SDLCALL SDL_GamepadHasAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis)

Implementation

bool sdlGamepadHasAxis(Pointer<SdlGamepad> gamepad, int axis) {
  final sdlGamepadHasAxisLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlGamepad> gamepad, Int32 axis),
      int Function(
          Pointer<SdlGamepad> gamepad, int axis)>('SDL_GamepadHasAxis');
  return sdlGamepadHasAxisLookupFunction(gamepad, axis) == 1;
}