libretro.drivers.sensor.driver

Protocol definition for accelerometer/gyroscope sensor drivers.

See also

libretro.api.sensor

The matching ctypes types and callback definitions.

Classes

SensorDriver

Describes the interface for input from a device's sensors.

class SensorDriver[source]

Bases: Protocol

Describes the interface for input from a device’s sensors.

Note

Corresponds to RETRO_ENVIRONMENT_GET_SENSOR_INTERFACE.

abstractmethod set_sensor_state(port, action, rate)[source]

Configure a sensor on a port, possibly with a specific query rate.

Corresponds to retro_set_sensor_state_t.

Note

The EnvironmentDriver should validate port against the maximum number of players (if any), skipping this method and returning False if the port is invalid.

Parameters:
  • port (Port (int)) – The input port to configure the sensors for.

  • action (SensorAction) – The action to perform on the sensor.

  • rate (int) – The rate at which to query the sensor.

Return type:

bool

Returns:

Whether the sensor was successfully configured.

abstractmethod get_sensor_input(port, sensor)[source]

Corresponds to retro_sensor_get_input_t.

Return type:

float

abstractmethod poll()[source]

Update the sensor driver’s readings.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)