Axis of a feature (analog stick, accelerometer, etc)
Axes are composed of two driver primitives, one for the positive semiaxis and one for the negative semiaxis.
This effectively means that an axis is two-dimensional, with each dimension either:
- a digital value (0.0 or 1.0)
- an analog value (continuous in the interval [0.0, 1.0])
float KODI::JOYSTICK::CFeatureAxis::GetPosition |
( |
void | | ) |
const |
|
inline |
Get the final value of this axis.
This axis is two-dimensional, so we need to compress these into a single dimension. This is done by subtracting the negative from the positive. Some examples:
Positive axis: 1.0 (User presses right or analog stick moves right)
Negative axis: 0.0
-------------------
Pos - Neg: 1.0 (Emulated analog stick moves right)
Positive axis: 0.0
Negative axis: 1.0 (User presses left or analog stick moves left)
-------------------
Pos - Neg: -1.0 (Emulated analog stick moves left)
Positive axis: 1.0 (User presses both buttons)
Negative axis: 1.0
-------------------
Pos - Neg: 0.0 (Emulated analog stick is centered)