Skip to main content

Module sensor

Module sensor 

Source
Expand description

SDL sensor management.

These APIs grant access to gyros and accelerometers on various platforms.

In order to use these functions, SDL_Init() must have been called with the SDL_INIT_SENSOR flag. This causes SDL to scan the system for sensors, and load appropriate drivers.

Structs§

SDL_Sensor
The opaque structure used to identify an opened SDL sensor.
SDL_SensorID
This is a unique ID for a sensor for the time it is connected to the system, and is never reused for the lifetime of the application.
SDL_SensorType
The different sensors defined by SDL.

Constants§

SDL_SENSOR_ACCEL
Accelerometer
SDL_SENSOR_ACCEL_L
Accelerometer for left Joy-Con controller and Wii nunchuk
SDL_SENSOR_ACCEL_R
Accelerometer for right Joy-Con controller
SDL_SENSOR_COUNT
SDL_SENSOR_GYRO
Gyroscope
SDL_SENSOR_GYRO_L
Gyroscope for left Joy-Con controller
SDL_SENSOR_GYRO_R
Gyroscope for right Joy-Con controller
SDL_SENSOR_INVALID
Returned for an invalid sensor
SDL_SENSOR_UNKNOWN
Unknown sensor type
SDL_STANDARD_GRAVITY
A constant to represent standard gravity for accelerometer sensors.

Functions§

SDL_CloseSensor
Close a sensor previously opened with SDL_OpenSensor().
SDL_GetSensorData
Get the current state of an opened sensor.
SDL_GetSensorFromID
Return the SDL_Sensor associated with an instance ID.
SDL_GetSensorID
Get the instance ID of a sensor.
SDL_GetSensorName
Get the implementation dependent name of a sensor.
SDL_GetSensorNameForID
Get the implementation dependent name of a sensor.
SDL_GetSensorNonPortableType
Get the platform dependent type of a sensor.
SDL_GetSensorNonPortableTypeForID
Get the platform dependent type of a sensor.
SDL_GetSensorProperties
Get the properties associated with a sensor.
SDL_GetSensorType
Get the type of a sensor.
SDL_GetSensorTypeForID
Get the type of a sensor.
SDL_GetSensors
Get a list of currently connected sensors.
SDL_OpenSensor
Open a sensor for use.
SDL_UpdateSensors
Update the current state of the open sensors.