Fabian Schlenz
382631d7d7
the effects to show animations that stay fluid independent of the current frame rate.
26 lines
683 B
C++
26 lines
683 B
C++
#include "effect_marquee.h"
|
|
#include "fonts.h"
|
|
|
|
boolean MarqueeEffect::can_be_shown_with_clock() {
|
|
return true;
|
|
}
|
|
|
|
void MarqueeEffect::loop(uint16_t ms) {
|
|
window->clear();
|
|
CRGB color = CHSV(0, 255, 255);
|
|
uint16_t width = _text.length() * 6;
|
|
window->drawSubText(&font5x7, _position, 0, _text, &color);
|
|
_position-=100;
|
|
if ((_position>>8) <= -width) { // Font is out of the window
|
|
_position = 0;
|
|
}
|
|
if ((_position>>8) + width < window->width) { // Text isn't filling the window up any more
|
|
window->drawSubText(&font5x7, _position + (width<<8), 0, _text, &color);
|
|
}
|
|
|
|
}
|
|
|
|
void MarqueeEffect::apply_option(String key, String value) {
|
|
if (key.equals("text")) _text = value;
|
|
}
|