There are now global instances of Window which don't have to be created and deleted all the time.
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
|
||||
class Effect {
|
||||
protected:
|
||||
Window* window = Window::getFullWindow(); // Use a full screen window per default.
|
||||
Window* window = &Window::window_full; // Use a full screen window per default.
|
||||
public:
|
||||
virtual ~Effect() {};
|
||||
virtual void loop(uint16_t ms) = 0;
|
||||
|
@ -14,10 +14,13 @@ private:
|
||||
void _circle_point(int x0, int y0, int x1, int y1, CRGB* color);
|
||||
void _subpixel_render(uint8_t x, uint8_t y, CRGB* color, SubpixelRenderingMode m);
|
||||
public:
|
||||
static Window window_full;
|
||||
static Window window_with_clock;
|
||||
static Window window_clock;
|
||||
|
||||
const uint8_t x, y;
|
||||
const uint8_t width, height;
|
||||
uint16_t count;
|
||||
static Window* getFullWindow();
|
||||
|
||||
Window(): Window(0, 0, LED_WIDTH, LED_HEIGHT) {};
|
||||
Window(uint8_t x, uint8_t y) : Window(x, y, LED_WIDTH-x, LED_HEIGHT-y) {};
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
|
||||
class Blur2DEffect : public Effect {
|
||||
private:
|
||||
Window* window = new Window(0, 0, LED_WIDTH, LED_HEIGHT-6);
|
||||
Window* window = &Window::window_with_clock;
|
||||
uint8_t _count;
|
||||
Blur2DBlob* _blobs;
|
||||
public:
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
class ClockEffect : public Effect {
|
||||
protected:
|
||||
Window* window = new Window(0, LED_HEIGHT - 6, LED_WIDTH, 6);
|
||||
Window* window = &Window::window_clock;
|
||||
|
||||
public:
|
||||
virtual ~ClockEffect();
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
class DvdEffect : public Effect {
|
||||
private:
|
||||
Window* window = new Window(0, 0, LED_WIDTH, LED_HEIGHT-6);
|
||||
Window* window = &Window::window_with_clock;
|
||||
saccum78 _x = 0;
|
||||
saccum78 _y = 0;
|
||||
int8_t _x_dir = 1;
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
|
||||
class BigDynamicEffect : public Effect {
|
||||
private:
|
||||
Window* window = new Window(0, 0, LED_WIDTH, LED_HEIGHT-6);
|
||||
Window* window = &Window::window_with_clock;
|
||||
public:
|
||||
void loop(uint16_t ms);
|
||||
~BigDynamicEffect();
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
|
||||
class FireworkEffect : public Effect {
|
||||
private:
|
||||
Window* window = new Window(0, 0, LED_WIDTH, LED_HEIGHT-6);
|
||||
Window* window = &Window::window_with_clock;
|
||||
bool _skyburst = 0;
|
||||
|
||||
accum88 _burst_x;
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
class MarqueeEffect : public Effect {
|
||||
private:
|
||||
Window* window = new Window(0, 0, LED_WIDTH, LED_HEIGHT-6);
|
||||
Window* window = &Window::window_with_clock;
|
||||
String _text = String("No text set +++ ");
|
||||
saccum78 _position = (window->width<<8);
|
||||
public:
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
class TvStaticEffect : public Effect {
|
||||
private:
|
||||
Window* _window = new Window(0, 0, LED_WIDTH, LED_HEIGHT-6);
|
||||
Window* _window = &Window::window_with_clock;
|
||||
public:
|
||||
~TvStaticEffect();
|
||||
void loop(uint16_t ms) override;
|
||||
|
Reference in New Issue
Block a user