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

Base class for joystick features. More...

#include <FeatureHandling.h>

Inheritance diagram for KODI::JOYSTICK::CJoystickFeature:
KODI::JOYSTICK::CAccelerometer KODI::JOYSTICK::CAnalogStick KODI::JOYSTICK::CAxisFeature KODI::JOYSTICK::CScalarFeature KODI::JOYSTICK::CThrottle KODI::JOYSTICK::CWheel

Public Member Functions

 CJoystickFeature (const FeatureName &name, IInputHandler *handler, IButtonMap *buttonMap)
 
virtual ~CJoystickFeature ()=default
 
virtual bool OnDigitalMotion (const CDriverPrimitive &source, bool bPressed)=0
 A digital motion has occurred.
 
virtual bool OnAnalogMotion (const CDriverPrimitive &source, float magnitude)=0
 An analog motion has occurred.
 
virtual void ProcessMotions (void)=0
 Process the motions that have occurred since the last invocation.
 
bool AcceptsInput (bool bActivation)
 Check if the input handler is accepting input.
 

Protected Member Functions

void ResetMotion ()
 Reset motion timer.
 
void StartMotion ()
 Start the motion timer.
 
bool InMotion () const
 Check if the feature is in motion.
 
unsigned int MotionTimeMs () const
 Get the time for which the feature has been in motion.
 

Protected Attributes

const FeatureName m_name
 
IInputHandler *const m_handler
 
IButtonMap *const m_buttonMap
 
const bool m_bEnabled
 

Detailed Description

Base class for joystick features.

See list of feature types in JoystickTypes.h.

Constructor & Destructor Documentation

◆ CJoystickFeature()

CJoystickFeature::CJoystickFeature ( const FeatureName & name,
IInputHandler * handler,
IButtonMap * buttonMap )

◆ ~CJoystickFeature()

virtual KODI::JOYSTICK::CJoystickFeature::~CJoystickFeature ( )
virtualdefault

Member Function Documentation

◆ AcceptsInput()

bool CJoystickFeature::AcceptsInput ( bool bActivation)

Check if the input handler is accepting input.

Parameters
bActivationTrue if the motion is activating (true or positive), false if the motion is deactivating (false or zero)
Returns
True if input should be sent to the input handler, false otherwise

◆ InMotion()

bool CJoystickFeature::InMotion ( ) const
protected

Check if the feature is in motion.

◆ MotionTimeMs()

unsigned int CJoystickFeature::MotionTimeMs ( ) const
protected

Get the time for which the feature has been in motion.

◆ OnAnalogMotion()

virtual bool KODI::JOYSTICK::CJoystickFeature::OnAnalogMotion ( const CDriverPrimitive & source,
float magnitude )
pure virtual

An analog motion has occurred.

Parameters
sourceThe source of the motion. Must be a semiaxis
magnitudeThe magnitude of the press or motion in the interval [0.0, 1.0]

For semiaxes, the magnitude is the force or travel distance in the direction of the semiaxis. If the value is in the opposite direction, the magnitude is 0.0.

For example, if the analog stick goes left, the negative semiaxis will have a value of 1.0 and the positive semiaxis will have a value of 0.0.

Implemented in KODI::JOYSTICK::CScalarFeature, KODI::JOYSTICK::CWheel, KODI::JOYSTICK::CThrottle, KODI::JOYSTICK::CAnalogStick, and KODI::JOYSTICK::CAccelerometer.

◆ OnDigitalMotion()

virtual bool KODI::JOYSTICK::CJoystickFeature::OnDigitalMotion ( const CDriverPrimitive & source,
bool bPressed )
pure virtual

A digital motion has occurred.

Parameters
sourceThe source of the motion. Must be digital (button or hat)
bPressedTrue for press motion, false for release motion
Returns
true if the motion was handled, false otherwise

Implemented in KODI::JOYSTICK::CScalarFeature, KODI::JOYSTICK::CAxisFeature, KODI::JOYSTICK::CAnalogStick, and KODI::JOYSTICK::CAccelerometer.

◆ ProcessMotions()

virtual void KODI::JOYSTICK::CJoystickFeature::ProcessMotions ( void )
pure virtual

Process the motions that have occurred since the last invocation.

This allows features with motion on multiple driver primitives to call their handler once all driver primitives are accounted for.

Implemented in KODI::JOYSTICK::CScalarFeature, KODI::JOYSTICK::CAxisFeature, KODI::JOYSTICK::CAnalogStick, and KODI::JOYSTICK::CAccelerometer.

◆ ResetMotion()

void CJoystickFeature::ResetMotion ( )
protected

Reset motion timer.

◆ StartMotion()

void CJoystickFeature::StartMotion ( )
protected

Start the motion timer.

Member Data Documentation

◆ m_bEnabled

const bool KODI::JOYSTICK::CJoystickFeature::m_bEnabled
protected

◆ m_buttonMap

IButtonMap* const KODI::JOYSTICK::CJoystickFeature::m_buttonMap
protected

◆ m_handler

IInputHandler* const KODI::JOYSTICK::CJoystickFeature::m_handler
protected

◆ m_name

const FeatureName KODI::JOYSTICK::CJoystickFeature::m_name
protected

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