JBWOPR
Loading...
Searching...
No Matches
JBWoprScrollTextDisplayEffect Class Reference

Display effect for scrolling text. More...

#include <jbwopreffects.h>

Inheritance diagram for JBWoprScrollTextDisplayEffect:
JBWoprEffectBase JBWoprXmasSecondsDisplayEffect

Public Member Functions

 JBWoprScrollTextDisplayEffect (JBWoprDevice *woprDevice, const std::string &text, uint32_t scrollSpeed=200, uint32_t duration=-1, const std::string &name=JBWOPR_EFFECT_NAME_SCROLLTEXT)
 Constructor.
 
void start () override
 Start effect.
 
void loop () override
 Run loop.
 
virtual void setText (const std::string &text)
 Set text to display.
 
void setScrollSpeed (uint32_t scrollSpeed)
 Set scroll speed.
 
- Public Member Functions inherited from JBWoprEffectBase
 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 stop ()
 Stop effect.
 
bool isRunning () const
 Check if effect is running.
 
uint32_t getDuration () const
 Set duration of effect.
 

Protected Attributes

std::string _text
 Text to display.
 
uint32_t _scrollSpeed = 200
 Scroll speed in milliseconds.
 
size_t _currentIndex = 0
 Current character index.
 
size_t _totalLength = 0
 Total length of text.
 
size_t _endIndex = 0
 End index of text.
 
- Protected Attributes inherited from JBWoprEffectBase
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.
 

Additional Inherited Members

- Protected Member Functions inherited from JBWoprEffectBase
void _displayText (const std::string &text, JBTextAlignment alignment=JBTextAlignment::LEFT)
 Display text on raw display.
 

Detailed Description

Display effect for scrolling text.

Constructor & Destructor Documentation

◆ JBWoprScrollTextDisplayEffect()

JBWoprScrollTextDisplayEffect::JBWoprScrollTextDisplayEffect ( JBWoprDevice woprDevice,
const std::string &  text,
uint32_t  scrollSpeed = 200,
uint32_t  duration = -1,
const std::string &  name = JBWOPR_EFFECT_NAME_SCROLLTEXT 
)
explicit

Constructor.

Parameters
woprDeviceJBWoprDevice instance
textText to display
scrollSpeed(optional) Scroll speed in milliseconds, default is 200
duration(optional) Duration after scrolling in milliseconds, default is -1 (infinite)
name(optional) Name of effect

Member Function Documentation

◆ loop()

void JBWoprScrollTextDisplayEffect::loop ( )
overridevirtual

Run loop.

Reimplemented from JBWoprEffectBase.

◆ setScrollSpeed()

void JBWoprScrollTextDisplayEffect::setScrollSpeed ( uint32_t  scrollSpeed)

Set scroll speed.

Parameters
scrollSpeedScroll speed in milliseconds

◆ setText()

void JBWoprScrollTextDisplayEffect::setText ( const std::string &  text)
virtual

Set text to display.

Parameters
textText to display

◆ start()

void JBWoprScrollTextDisplayEffect::start ( )
overridevirtual

Start effect.

Reimplemented from JBWoprEffectBase.

Reimplemented in JBWoprXmasSecondsDisplayEffect.


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