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

Interface defining methods to handle joystick events for raw driver elements (buttons, hats, axes) More...

#include <IDriverHandler.h>

Inheritance diagram for KODI::JOYSTICK::IDriverHandler:
KODI::JOYSTICK::CButtonMapping KODI::JOYSTICK::CInputHandling PERIPHERALS::CAddonButtonMapping PERIPHERALS::CAddonInputHandling

Public Member Functions

virtual ~IDriverHandler ()=default
 
virtual bool OnButtonMotion (unsigned int buttonIndex, bool bPressed)=0
 Handle button motion.
 
virtual bool OnHatMotion (unsigned int hatIndex, HAT_STATE state)=0
 Handle hat motion.
 
virtual bool OnAxisMotion (unsigned int axisIndex, float position, int center, unsigned int range)=0
 Handle axis motion.
 
virtual void OnInputFrame (void)=0
 Handle buffered input motion for features that require multiple axes.
 

Detailed Description

Interface defining methods to handle joystick events for raw driver elements (buttons, hats, axes)

Constructor & Destructor Documentation

◆ ~IDriverHandler()

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

Member Function Documentation

◆ OnAxisMotion()

virtual bool KODI::JOYSTICK::IDriverHandler::OnAxisMotion ( unsigned int axisIndex,
float position,
int center,
unsigned int range )
pure virtual

Handle axis motion.

If a joystick feature requires multiple axes (analog sticks, accelerometers), they can be buffered for later processing.

Parameters
axisIndexThe index of the axis as reported by the driver
positionThe position of the axis in the closed interval [-1.0, 1.0]
centerThe center point of the axis (either -1, 0 or 1)
rangeThe maximum distance the axis can move (either 1 or 2)
Returns
True if the motion was handled, false otherwise

Implemented in KODI::JOYSTICK::CButtonMapping, KODI::JOYSTICK::CInputHandling, PERIPHERALS::CAddonButtonMapping, and PERIPHERALS::CAddonInputHandling.

◆ OnButtonMotion()

virtual bool KODI::JOYSTICK::IDriverHandler::OnButtonMotion ( unsigned int buttonIndex,
bool bPressed )
pure virtual

Handle button motion.

Parameters
buttonIndexThe index of the button as reported by the driver
bPressedtrue for press motion, false for release motion
Returns
True if a press was handled, false otherwise

Implemented in KODI::JOYSTICK::CButtonMapping, KODI::JOYSTICK::CInputHandling, PERIPHERALS::CAddonButtonMapping, and PERIPHERALS::CAddonInputHandling.

◆ OnHatMotion()

virtual bool KODI::JOYSTICK::IDriverHandler::OnHatMotion ( unsigned int hatIndex,
HAT_STATE state )
pure virtual

Handle hat motion.

Parameters
hatIndexThe index of the hat as reported by the driver
stateThe direction the hat is now being pressed
Returns
True if the new direction was handled, false otherwise

Implemented in KODI::JOYSTICK::CButtonMapping, KODI::JOYSTICK::CInputHandling, PERIPHERALS::CAddonButtonMapping, and PERIPHERALS::CAddonInputHandling.

◆ OnInputFrame()

virtual void KODI::JOYSTICK::IDriverHandler::OnInputFrame ( void )
pure virtual

Handle buffered input motion for features that require multiple axes.

OnInputFrame() is called at the end of the frame when all axis motions have been reported. This has several uses, including:

  • Combining multiple axes into a single analog stick or accelerometer event
  • Imitating an analog feature with a digital button so that events can be dispatched every frame.

Implemented in KODI::JOYSTICK::CButtonMapping, KODI::JOYSTICK::CInputHandling, PERIPHERALS::CAddonButtonMapping, and PERIPHERALS::CAddonInputHandling.


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