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>
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).
◆ AddEventConfig() [1/2]
void KODI::UTILS::MOVING_SPEED::CMovingSpeed::AddEventConfig |
( |
uint32_t | eventId, |
|
|
EventCfg | event ) |
Add the configuration for an event.
- Parameters
-
eventId | The id for the event, must be unique |
event | The event configuration |
◆ AddEventConfig() [2/2]
void KODI::UTILS::MOVING_SPEED::CMovingSpeed::AddEventConfig |
( |
uint32_t | eventId, |
|
|
float | acceleration, |
|
|
float | maxVelocity, |
|
|
uint32_t | resetTimeout ) |
Add the configuration for an event.
- Parameters
-
eventId | The id for the event, must be unique |
acceleration | Acceleration in pixels per second (px/sec) |
maxVelocity | Max movement speed, it depends from acceleration value, a suitable value could be (acceleration value)*3. Set 0 to disable it |
resetTimeout | Resets acceleration speed if idle for specified millisecs |
◆ AddEventMapConfig()
void KODI::UTILS::MOVING_SPEED::CMovingSpeed::AddEventMapConfig |
( |
MapEventConfig & | configs | ) |
|
Add a map of events configuration.
- Parameters
-
configs | The map of events configuration where key value is event id, |
◆ GetUpdatedDistance() [1/2]
float KODI::UTILS::MOVING_SPEED::CMovingSpeed::GetUpdatedDistance |
( |
EventType | eventType | ) |
|
|
inline |
Get the updated distance based on acceleration speed.
- Parameters
-
eventType | The event type to handle |
- Returns
- The distance
◆ GetUpdatedDistance() [2/2]
float KODI::UTILS::MOVING_SPEED::CMovingSpeed::GetUpdatedDistance |
( |
uint32_t | eventId | ) |
|
Get the updated distance based on acceleration speed.
- Parameters
-
eventId | The id for the event to handle |
- Returns
- The distance
◆ Reset() [1/2]
void KODI::UTILS::MOVING_SPEED::CMovingSpeed::Reset |
( |
| ) |
|
Reset stored velocity to all events.
- Parameters
-
event | The event configuration |
◆ Reset() [2/2]
void KODI::UTILS::MOVING_SPEED::CMovingSpeed::Reset |
( |
uint32_t | eventId | ) |
|
Reset stored velocity for a specific event.
- Parameters
-
The documentation for this class was generated from the following files: