kodi
Public Member Functions | Protected Attributes | List of all members
KODI::JOYSTICK::CFeatureAxis Class Reference

Axis of a feature (analog stick, accelerometer, etc) More...

#include <FeatureHandling.h>

Public Member Functions

void SetPositiveDistance (float distance)
 Set value of positive axis.
 
void SetNegativeDistance (float distance)
 Set value of negative axis.
 
float GetPosition (void) const
 Get the final value of this axis. More...
 
void Reset (void)
 Reset both positive and negative values to zero.
 

Protected Attributes

float m_positiveDistance
 
float m_negativeDistance
 

Detailed Description

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:

Member Function Documentation

◆ GetPosition()

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)

The documentation for this class was generated from the following file: