kodi
Public Member Functions | List of all members
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:
Inheritance graph
[legend]

Public Member Functions

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

Detailed Description

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

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, PERIPHERALS::CAddonInputHandling, PERIPHERALS::CAddonButtonMapping, and KODI::JOYSTICK::CInputHandling.

◆ 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, PERIPHERALS::CAddonInputHandling, PERIPHERALS::CAddonButtonMapping, and KODI::JOYSTICK::CInputHandling.

◆ 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, PERIPHERALS::CAddonInputHandling, PERIPHERALS::CAddonButtonMapping, and KODI::JOYSTICK::CInputHandling.

◆ 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, PERIPHERALS::CAddonInputHandling, PERIPHERALS::CAddonButtonMapping, and KODI::JOYSTICK::CInputHandling.


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