Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
UTILS::MOVING_SPEED::CMovingSpeed Class Reference

Class to calculate the velocity for a motion effect. To ensure it works, the GetUpdatedDistance method must be called at each input received (e.g. continuous key press of same key on the keyboard). The motion effect will stop at the event ID change (different key pressed). More...

#include <MovingSpeed.h>

Public Member Functions

void AddEventConfig (uint32_t eventId, float acceleration, float maxVelocity, uint32_t resetTimeout)
 Add the configuration for an event.
 
void AddEventConfig (uint32_t eventId, EventCfg event)
 Add the configuration for an event.
 
void AddEventMapConfig (MapEventConfig &configs)
 Add a map of events configuration.
 
void Reset ()
 Reset stored velocity to all events.
 
void Reset (uint32_t eventId)
 Reset stored velocity for a specific event.
 
float GetUpdatedDistance (uint32_t eventId)
 Get the updated distance based on acceleration speed.
 
float GetUpdatedDistance (EventType eventType)
 Get the updated distance based on acceleration speed.
 

Detailed Description

Class to calculate the velocity for a motion effect. To ensure it works, the GetUpdatedDistance method must be called at each input received (e.g. continuous key press of same key on the keyboard). The motion effect will stop at the event ID change (different key pressed).

Member Function Documentation

◆ AddEventConfig() [1/2]

void UTILS::MOVING_SPEED::CMovingSpeed::AddEventConfig ( uint32_t eventId,
EventCfg event )

Add the configuration for an event.

Parameters
eventIdThe id for the event, must be unique
eventThe event configuration

◆ AddEventConfig() [2/2]

void UTILS::MOVING_SPEED::CMovingSpeed::AddEventConfig ( uint32_t eventId,
float acceleration,
float maxVelocity,
uint32_t resetTimeout )

Add the configuration for an event.

Parameters
eventIdThe id for the event, must be unique
accelerationAcceleration in pixels per second (px/sec)
maxVelocityMax movement speed, it depends from acceleration value, a suitable value could be (acceleration value)*3. Set 0 to disable it
resetTimeoutResets acceleration speed if idle for specified millisecs

◆ AddEventMapConfig()

void UTILS::MOVING_SPEED::CMovingSpeed::AddEventMapConfig ( MapEventConfig & configs)

Add a map of events configuration.

Parameters
configsThe map of events configuration where key value is event id,

◆ GetUpdatedDistance() [1/2]

float UTILS::MOVING_SPEED::CMovingSpeed::GetUpdatedDistance ( EventType eventType)
inline

Get the updated distance based on acceleration speed.

Parameters
eventTypeThe event type to handle
Returns
The distance

◆ GetUpdatedDistance() [2/2]

float UTILS::MOVING_SPEED::CMovingSpeed::GetUpdatedDistance ( uint32_t eventId)

Get the updated distance based on acceleration speed.

Parameters
eventIdThe id for the event to handle
Returns
The distance

◆ Reset() [1/2]

void UTILS::MOVING_SPEED::CMovingSpeed::Reset ( )

Reset stored velocity to all events.

Parameters
eventThe event configuration

◆ Reset() [2/2]

void UTILS::MOVING_SPEED::CMovingSpeed::Reset ( uint32_t eventId)

Reset stored velocity for a specific event.

Parameters
eventThe event ID

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