sdlGetSensorData function

bool sdlGetSensorData(
  1. Pointer<SdlSensor> sensor,
  2. Pointer<Float> data,
  3. int numValues
)

Get the current state of an opened sensor.

The number of values and interpretation of the data is sensor dependent.

\param sensor the SDL_Sensor object to query. \param data a pointer filled with the current sensor state. \param num_values the number of values to write to data. \returns true on success or false on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

extern SDL_DECLSPEC bool SDLCALL SDL_GetSensorData(SDL_Sensor *sensor, float *data, int num_values)

Implementation

bool sdlGetSensorData(
    Pointer<SdlSensor> sensor, Pointer<Float> data, int numValues) {
  final sdlGetSensorDataLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(
          Pointer<SdlSensor> sensor, Pointer<Float> data, Int32 numValues),
      int Function(Pointer<SdlSensor> sensor, Pointer<Float> data,
          int numValues)>('SDL_GetSensorData');
  return sdlGetSensorDataLookupFunction(sensor, data, numValues) == 1;
}