Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
KODI::JOYSTICK::CFeatureAxis Class Reference

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

#include <FeatureHandling.h>

Public Member Functions

 CFeatureAxis (void)
 
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.
 
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:

  • a digital value (0.0 or 1.0)
  • an analog value (continuous in the interval [0.0, 1.0])

Constructor & Destructor Documentation

◆ CFeatureAxis()

KODI::JOYSTICK::CFeatureAxis::CFeatureAxis ( void )
inline

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)

◆ Reset()

void KODI::JOYSTICK::CFeatureAxis::Reset ( void )
inline

Reset both positive and negative values to zero.

◆ SetNegativeDistance()

void KODI::JOYSTICK::CFeatureAxis::SetNegativeDistance ( float distance)
inline

Set value of negative axis.

◆ SetPositiveDistance()

void KODI::JOYSTICK::CFeatureAxis::SetPositiveDistance ( float distance)
inline

Set value of positive axis.

Member Data Documentation

◆ m_negativeDistance

float KODI::JOYSTICK::CFeatureAxis::m_negativeDistance
protected

◆ m_positiveDistance

float KODI::JOYSTICK::CFeatureAxis::m_positiveDistance
protected

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