JBWOPR
|
Abstract effect base class. More...
#include <jbwopreffects.h>
Public Member Functions | |
JBWoprEffectBase (JBWoprDevice *woprDevice, uint32_t duration=-1, std::string name=JBWOPR_EFFECT_NAME_BASE) | |
Constructor. | |
virtual std::string | getName () |
Get name of effect. | |
virtual void | start () |
Start effect. | |
virtual void | stop () |
Stop effect. | |
virtual void | loop () |
Run loop. | |
bool | isRunning () const |
Check if effect is running. | |
uint32_t | getDuration () const |
Set duration of effect. | |
Protected Member Functions | |
void | _displayText (const std::string &text, JBTextAlignment alignment=JBTextAlignment::LEFT) |
Display text on raw display. | |
Protected Attributes | |
JBWoprDevice * | _woprDevice |
JBWoprDevice instance. | |
std::string | _name |
Name of effect. | |
bool | _isRunning = false |
True if effect is running. | |
bool | _done = true |
True if effect is done, waiting for duration to end. | |
uint32_t | _duration = -1 |
Duration of effect in milliseconds. | |
uint32_t | _startTime = 0 |
Start time of effect in milliseconds. | |
uint32_t | _nextTick = 0 |
Next tick time in milliseconds. | |
Abstract effect base class.
|
explicit |
Constructor.
WOPRDevice | instance |
duration | (optional) Duration of effect in milliseconds, default is -1 (infinite) |
name | (optional) Name of effect |
|
protected |
Display text on raw display.
This method will display text on the raw display without using the displayShowText() method of the JBWoprDevice class.
text | Text to display |
alignment | (optional) Text alignment, default is LEFT |
uint32_t JBWoprEffectBase::getDuration | ( | ) | const |
Set duration of effect.
duration | Duration of effect in milliseconds |
|
virtual |
Get name of effect.
bool JBWoprEffectBase::isRunning | ( | ) | const |
Check if effect is running.
|
virtual |
Run loop.
Reimplemented in JBWoprTextDisplayEffect, JBWoprScrollTextDisplayEffect, JBWoprTimeDisplayEffect, JBWoprTimeDisplayRainbowEffect, JBWoprDateDisplayEffect, JBWoprDateDisplayRainbowEffect, JBWoprDateTimeDisplayEffect, JBWoprDateTimeDisplayRainbowEffect, JBWoprMissileCodeSolveEffect, JBWoprDefconRainbowEffect, and JBWoprSongEffect.
|
virtual |
Start effect.
Reimplemented in JBWoprTextDisplayEffect, JBWoprScrollTextDisplayEffect, JBWoprTimeDisplayEffect, JBWoprDateDisplayEffect, JBWoprDateTimeDisplayEffect, JBWoprXmasSecondsDisplayEffect, JBWoprMissileCodeSolveEffect, and JBWoprSongEffect.