Sensor#

Enums

enum sfSensorType#

Sensor Types.

Values:

enumerator sfSensorAccelerometer#

Measures the raw acceleration (m/s^2)

enumerator sfSensorGyroscope#

Measures the raw rotation rates (degrees/s)

enumerator sfSensorMagnetometer#

Measures the ambient magnetic field (micro-teslas)

enumerator sfSensorGravity#

Measures the direction and intensity of gravity, independent of device acceleration (m/s^2)

enumerator sfSensorUserAcceleration#

Measures the direction and intensity of device acceleration, independent of the gravity (m/s^2)

enumerator sfSensorOrientation#

Measures the absolute 3D orientation (degrees)

enumerator sfSensorCount#

Keep last — the total number of sensor types.

Functions

sfBool sfSensor_isAvailable(sfSensorType sensor)#

Check if a sensor is available on the underlying platform.

Parameters:
  • sensor – Sensor to check

Returns:

sfTrue if the sensor is available, sfFalse otherwise

void sfSensor_setEnabled(sfSensorType sensor, sfBool enabled)#

Enable or disable a sensor.

All sensors are disabled by default, to avoid consuming too much battery power. Once a sensor is enabled, it starts sending events of the corresponding type.

This function does nothing if the sensor is unavailable.

Parameters:
  • sensor – Sensor to enable

  • enabled – sfTrue to enable, sfFalse to disable

sfVector3f sfSensor_getValue(sfSensorType sensor)#

Get the current sensor value.

Parameters:
  • sensor – Sensor to read

Returns:

The current sensor value