mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-01-05 21:07:53 +00:00
For gamepads that don't have their own sensors, try to use the system sensors.
This allows using the gyro and accelerometer in handheld devices in conjunction with built-in or wraparound controllers.
This commit is contained in:
@@ -504,6 +504,11 @@ int SDL_SendSensorUpdate(Uint64 timestamp, SDL_Sensor *sensor, Uint64 sensor_tim
|
||||
return posted;
|
||||
}
|
||||
|
||||
void SDL_UpdateSensor(SDL_Sensor *sensor)
|
||||
{
|
||||
sensor->driver->Update(sensor);
|
||||
}
|
||||
|
||||
void SDL_UpdateSensors(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -40,6 +40,9 @@ extern void SDL_UnlockSensors(void);
|
||||
/* Function to return whether there are any sensors opened by the application */
|
||||
extern SDL_bool SDL_SensorsOpened(void);
|
||||
|
||||
/* Update an individual sensor, used by gamepad sensor fusion */
|
||||
extern void SDL_UpdateSensor(SDL_Sensor *sensor);
|
||||
|
||||
/* Internal event queueing functions */
|
||||
extern int SDL_SendSensorUpdate(Uint64 timestamp, SDL_Sensor *sensor, Uint64 sensor_timestamp, float *data, int num_values);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user