Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
Class to translate input from the driver into higher-level features. More...
#include <InputHandling.h>
Public Member Functions | |
CInputHandling (IInputHandler *handler, IButtonMap *buttonMap) | |
~CInputHandling () override | |
bool | OnButtonMotion (unsigned int buttonIndex, bool bPressed) override |
Handle button motion. | |
bool | OnHatMotion (unsigned int hatIndex, HAT_STATE state) override |
Handle hat motion. | |
bool | OnAxisMotion (unsigned int axisIndex, float position, int center, unsigned int range) override |
Handle axis motion. | |
void | OnInputFrame () override |
Handle buffered input motion for features that require multiple axes. | |
Public Member Functions inherited from KODI::JOYSTICK::IDriverHandler | |
virtual | ~IDriverHandler ()=default |
Class to translate input from the driver into higher-level features.
Raw driver input arrives for three elements: buttons, hats and axes. When driver input is handled by this class, it translates the raw driver elements into physical joystick features, such as buttons, analog sticks, etc.
A button map is used to translate driver primitives to controller features. The button map has been abstracted away behind the IButtonMap interface so that it can be provided by an add-on.
CInputHandling::CInputHandling | ( | IInputHandler * | handler, |
IButtonMap * | buttonMap ) |
|
overridedefault |
|
overridevirtual |
Handle axis motion.
If a joystick feature requires multiple axes (analog sticks, accelerometers), they can be buffered for later processing.
axisIndex | The index of the axis as reported by the driver |
position | The position of the axis in the closed interval [-1.0, 1.0] |
center | The center point of the axis (either -1, 0 or 1) |
range | The maximum distance the axis can move (either 1 or 2) |
Implements KODI::JOYSTICK::IDriverHandler.
Handle button motion.
buttonIndex | The index of the button as reported by the driver |
bPressed | true for press motion, false for release motion |
Implements KODI::JOYSTICK::IDriverHandler.
Handle hat motion.
hatIndex | The index of the hat as reported by the driver |
state | The direction the hat is now being pressed |
Implements KODI::JOYSTICK::IDriverHandler.
|
overridevirtual |
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:
Implements KODI::JOYSTICK::IDriverHandler.