pitrix/include/effect_matrix.h

64 lines
1.4 KiB
C
Raw Normal View History

#pragma once
#include "prototypes.h"
#include "Effect.h"
#include "config.h"
#include "my_fastled.h"
#include "my_color_palettes.h"
class MatrixEffectColumn {
protected:
Window* window;
int x, y;
int length = 1;
virtual CRGB _getColor(uint8_t height);
virtual void restart();
private:
uint16_t speed;
boolean running;
unsigned long last_move = 0;
2019-06-07 04:24:16 +00:00
public:
MatrixEffectColumn(Window* win, int xPos);
virtual ~MatrixEffectColumn() {};
void advance();
void draw();
void loop();
};
class RainbowMatrixEffectColumn : public MatrixEffectColumn {
protected:
CRGB _getColor(uint8_t height) override;
public:
RainbowMatrixEffectColumn(Window* win, int xPos) : MatrixEffectColumn(win, xPos) {};
};
class RandomMatrixEffectColumn : public MatrixEffectColumn {
protected:
uint8_t _hue = 42;
CRGB _getColor(uint8_t height) override;
void restart() override;
public:
RandomMatrixEffectColumn(Window* win, int xPos) : MatrixEffectColumn(win, xPos) {};
};
class MatrixEffect : public Effect {
protected:
MatrixEffectColumn** _columns;
virtual void _init();
2019-06-07 04:24:16 +00:00
public:
boolean can_be_shown_with_clock();
MatrixEffect();
virtual ~MatrixEffect();
void loop();
};
class RainbowMatrixEffect : public MatrixEffect {
private:
void _init() override;
};
class RandomMatrixEffect : public MatrixEffect {
private:
void _init() override;
};