xbmc
Public Member Functions | Protected Attributes | List of all members
KODI::JOYSTICK::CKeymapHandler Class Reference
Inheritance diagram for KODI::JOYSTICK::CKeymapHandler:
Inheritance graph
[legend]
Collaboration diagram for KODI::JOYSTICK::CKeymapHandler:
Collaboration graph
[legend]

Public Member Functions

 CKeymapHandler (IActionListener *actionHandler, const IKeymap *keymap)
 
bool HotkeysPressed (const std::set< std::string > &keyNames) const override
 Get the pressed state of the given keys. More...
 
std::string GetLastPressed () const override
 Get the key name of the last button pressed. More...
 
void OnPress (const std::string &keyName) override
 Called when a key has emitted an action after bring pressed. More...
 
std::string ControllerID () const override
 The add-on ID of the game controller associated with this input handler. More...
 
bool HasFeature (const FeatureName &feature) const override
 Return true if the input handler accepts the given feature. More...
 
bool AcceptsInput (const FeatureName &feature) const override
 Return true if the input handler is currently accepting input for the given feature. More...
 
bool OnButtonPress (const FeatureName &feature, bool bPressed) override
 A digital button has been pressed or released. More...
 
void OnButtonHold (const FeatureName &feature, unsigned int holdTimeMs) override
 A digital button has been pressed for more than one event frame. More...
 
bool OnButtonMotion (const FeatureName &feature, float magnitude, unsigned int motionTimeMs) override
 An analog button (trigger or a pressure-sensitive button) has changed state. More...
 
bool OnAnalogStickMotion (const FeatureName &feature, float x, float y, unsigned int motionTimeMs) override
 An analog stick has moved. More...
 
bool OnAccelerometerMotion (const FeatureName &feature, float x, float y, float z) override
 An accelerometer's state has changed. More...
 
bool OnWheelMotion (const FeatureName &feature, float position, unsigned int motionTimeMs) override
 A wheel has changed state. More...
 
bool OnThrottleMotion (const FeatureName &feature, float position, unsigned int motionTimeMs) override
 A throttle has changed state. More...
 
void OnInputFrame () override
 Called at the end of the frame that provided input.
 
- Public Member Functions inherited from KODI::JOYSTICK::IInputHandler
void SetInputReceiver (IInputReceiver *receiver)
 
void ResetInputReceiver (void)
 
IInputReceiverInputReceiver (void)
 

Protected Attributes

std::unique_ptr< IButtonSequencem_easterEgg
 

Member Function Documentation

◆ AcceptsInput()

bool CKeymapHandler::AcceptsInput ( const FeatureName feature) const
overridevirtual

Return true if the input handler is currently accepting input for the given feature.

Parameters
featureA feature belonging to the controller specified by ControllerID()
Returns
True if the feature is currently accepting input, false otherwise

This does not prevent the input events from being called, but can return false to indicate that input wasn't handled for the specified feature.

Implements KODI::JOYSTICK::IInputHandler.

◆ ControllerID()

std::string CKeymapHandler::ControllerID ( ) const
overridevirtual

The add-on ID of the game controller associated with this input handler.

Returns
The ID of the add-on extending kodi.game.controller

Implements KODI::JOYSTICK::IInputHandler.

◆ GetLastPressed()

std::string KODI::JOYSTICK::CKeymapHandler::GetLastPressed ( ) const
inlineoverridevirtual

Get the key name of the last button pressed.

Returns
The key name of the last-pressed button, or empty if no button is pressed

Implements KODI::JOYSTICK::IKeymapHandler.

◆ HasFeature()

bool KODI::JOYSTICK::CKeymapHandler::HasFeature ( const FeatureName feature) const
inlineoverridevirtual

Return true if the input handler accepts the given feature.

Parameters
featureA feature belonging to the controller specified by ControllerID()
Returns
True if the feature is used for input, false otherwise

Implements KODI::JOYSTICK::IInputHandler.

◆ HotkeysPressed()

bool CKeymapHandler::HotkeysPressed ( const std::set< std::string > &  keyNames) const
overridevirtual

Get the pressed state of the given keys.

Parameters
keyNamesThe key names
Returns
True if all keys are pressed or no keys are given, false otherwise

Implements KODI::JOYSTICK::IKeymapHandler.

◆ OnAccelerometerMotion()

bool CKeymapHandler::OnAccelerometerMotion ( const FeatureName feature,
float  x,
float  y,
float  z 
)
overridevirtual

An accelerometer's state has changed.

Parameters
featureThe accelerometer being accelerated
xThe x coordinate in the closed interval [-1, 1]
yThe y coordinate in the closed interval [-1, 1]
zThe z coordinate in the closed interval [-1, 1]
Returns
True if the event was handled otherwise false
Todo:
implement

Reimplemented from KODI::JOYSTICK::IInputHandler.

◆ OnAnalogStickMotion()

bool CKeymapHandler::OnAnalogStickMotion ( const FeatureName feature,
float  x,
float  y,
unsigned int  motionTimeMs 
)
overridevirtual

An analog stick has moved.

Parameters
featureThe analog stick being moved
xThe x coordinate in the closed interval [-1, 1]
yThe y coordinate in the closed interval [-1, 1]
motionTimeMsThe time elapsed since this analog stick was centered, or 0 if the analog stick is centered
Returns
True if the event was handled otherwise false

Implements KODI::JOYSTICK::IInputHandler.

◆ OnButtonHold()

void CKeymapHandler::OnButtonHold ( const FeatureName feature,
unsigned int  holdTimeMs 
)
overridevirtual

A digital button has been pressed for more than one event frame.

Parameters
featureThe feature being held
holdTimeMsThe time elapsed since the initial press (ms)

If OnButtonPress() returns true for the initial press, then this callback is invoked on subsequent frames until the button is released.

Implements KODI::JOYSTICK::IInputHandler.

◆ OnButtonMotion()

bool CKeymapHandler::OnButtonMotion ( const FeatureName feature,
float  magnitude,
unsigned int  motionTimeMs 
)
overridevirtual

An analog button (trigger or a pressure-sensitive button) has changed state.

Parameters
featureThe feature changing state
magnitudeThe button pressure or trigger travel distance in the closed interval [0, 1]
motionTimeMsThe time elapsed since the magnitude was 0
Returns
True if the event was handled otherwise false

Implements KODI::JOYSTICK::IInputHandler.

◆ OnButtonPress()

bool CKeymapHandler::OnButtonPress ( const FeatureName feature,
bool  bPressed 
)
overridevirtual

A digital button has been pressed or released.

Parameters
featureThe feature being pressed
bPressedTrue if pressed, false if released
Returns
True if the event was handled otherwise false

Implements KODI::JOYSTICK::IInputHandler.

◆ OnPress()

void KODI::JOYSTICK::CKeymapHandler::OnPress ( const std::string &  keyName)
inlineoverridevirtual

Called when a key has emitted an action after bring pressed.

Parameters
keyNamethe key name that emitted the action

Implements KODI::JOYSTICK::IKeymapHandler.

◆ OnThrottleMotion()

bool CKeymapHandler::OnThrottleMotion ( const FeatureName feature,
float  position,
unsigned int  motionTimeMs 
)
overridevirtual

A throttle has changed state.

Up is positive position, down is negative position.

Parameters
featureThe wheel changing state
positionThe position in the closed interval [-1, 1]
motionTimeMsThe time elapsed since the position was 0
Returns
True if the event was handled otherwise false

Implements KODI::JOYSTICK::IInputHandler.

◆ OnWheelMotion()

bool CKeymapHandler::OnWheelMotion ( const FeatureName feature,
float  position,
unsigned int  motionTimeMs 
)
overridevirtual

A wheel has changed state.

Left is negative position, right is positive position

Parameters
featureThe wheel changing state
positionThe position in the closed interval [-1, 1]
motionTimeMsThe time elapsed since the position was 0
Returns
True if the event was handled otherwise false

Implements KODI::JOYSTICK::IInputHandler.


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