sdlGetJoystickHat function

int sdlGetJoystickHat(
  1. Pointer<SdlJoystick> joystick,
  2. int hat
)

Get the current state of a POV hat on a joystick.

The returned value will be one of the SDL_HAT_* values.

\param joystick an SDL_Joystick structure containing joystick information. \param hat the hat index to get the state from; indices start at index 0. \returns the current hat position.

\since This function is available since SDL 3.1.3.

\sa SDL_GetNumJoystickHats

extern SDL_DECLSPEC Uint8 SDLCALL SDL_GetJoystickHat(SDL_Joystick *joystick, int hat)

Implementation

int sdlGetJoystickHat(Pointer<SdlJoystick> joystick, int hat) {
  final sdlGetJoystickHatLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlJoystick> joystick, Int32 hat),
      int Function(
          Pointer<SdlJoystick> joystick, int hat)>('SDL_GetJoystickHat');
  return sdlGetJoystickHatLookupFunction(joystick, hat);
}