pub const SDL_STANDARD_GRAVITY: c_float = 9.80665;
Expand description

Accelerometer sensor

The accelerometer returns the current acceleration in SI meters per second squared. This measurement includes the force of gravity, so a device at rest will have an value of SDL_STANDARD_GRAVITY away from the center of the earth.

  • values[0]: Acceleration on the x axis
  • values[1]: Acceleration on the y axis
  • values[2]: Acceleration on the z axis

For phones held in portrait mode and game controllers held in front of you, the axes are defined as follows:

  • -X … +X : left … right
  • -Y … +Y : bottom … top
  • -Z … +Z : farther … closer

The axis data is not changed when the phone is rotated.

See Also: SDL_GetDisplayOrientation