sdlSetGamepadSensorEnabled function gamepad

bool sdlSetGamepadSensorEnabled(
  1. Pointer<SdlGamepad> gamepad,
  2. int type,
  3. bool enabled
)

Set whether data reporting for a gamepad sensor is enabled.

\param gamepad the gamepad to update. \param type the type of sensor to enable/disable. \param enabled whether data reporting should be enabled. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.2.0.

\sa SDL_GamepadHasSensor \sa SDL_GamepadSensorEnabled

extern SDL_DECLSPEC bool SDLCALL SDL_SetGamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type, bool enabled)

Implementation

bool sdlSetGamepadSensorEnabled(
  Pointer<SdlGamepad> gamepad,
  int type,
  bool enabled,
) {
  final sdlSetGamepadSensorEnabledLookupFunction = _libSdl
      .lookupFunction<
        Uint8 Function(Pointer<SdlGamepad> gamepad, Int32 type, Uint8 enabled),
        int Function(Pointer<SdlGamepad> gamepad, int type, int enabled)
      >('SDL_SetGamepadSensorEnabled');
  return sdlSetGamepadSensorEnabledLookupFunction(
        gamepad,
        type,
        enabled ? 1 : 0,
      ) ==
      1;
}