2019-06-16 10:43:05 +00:00
|
|
|
#pragma once
|
2019-05-29 22:49:54 +00:00
|
|
|
|
|
|
|
#include "prototypes.h"
|
|
|
|
#include "Effect.h"
|
|
|
|
#include "config.h"
|
|
|
|
#include "my_fastled.h"
|
2019-06-04 03:55:24 +00:00
|
|
|
#include "my_color_palettes.h"
|
2019-05-29 22:49:54 +00:00
|
|
|
|
|
|
|
class MatrixEffectColumn {
|
2019-06-16 10:43:05 +00:00
|
|
|
protected:
|
2019-05-29 22:49:54 +00:00
|
|
|
Window* window;
|
2019-06-19 20:22:03 +00:00
|
|
|
uint8_t x, y;
|
|
|
|
uint8_t length = 1;
|
|
|
|
uint8_t _direction = 2;
|
|
|
|
bool _random_direction = false;
|
2019-06-16 10:43:05 +00:00
|
|
|
virtual CRGB _getColor(uint8_t height);
|
2019-06-19 20:22:03 +00:00
|
|
|
virtual void restart(bool completely_random);
|
2019-06-16 10:43:05 +00:00
|
|
|
private:
|
2019-05-30 09:26:13 +00:00
|
|
|
uint16_t speed;
|
2019-05-29 22:49:54 +00:00
|
|
|
boolean running;
|
2019-05-30 09:26:13 +00:00
|
|
|
unsigned long last_move = 0;
|
2019-06-07 04:24:16 +00:00
|
|
|
public:
|
2019-06-19 20:22:03 +00:00
|
|
|
static const uint8_t DIR_NORTH = 0;
|
|
|
|
static const uint8_t DIR_EAST = 1;
|
|
|
|
static const uint8_t DIR_SOUTH = 2;
|
|
|
|
static const uint8_t DIR_WEST = 3;
|
|
|
|
|
|
|
|
MatrixEffectColumn(Window* win, uint8_t direction=0, bool random_direction=false);
|
2019-06-18 16:09:05 +00:00
|
|
|
virtual ~MatrixEffectColumn() {};
|
2019-05-29 22:49:54 +00:00
|
|
|
void advance();
|
|
|
|
void draw();
|
|
|
|
void loop();
|
|
|
|
};
|
|
|
|
|
2019-06-16 10:43:05 +00:00
|
|
|
class RainbowMatrixEffectColumn : public MatrixEffectColumn {
|
|
|
|
protected:
|
|
|
|
CRGB _getColor(uint8_t height) override;
|
|
|
|
public:
|
2019-06-19 20:22:03 +00:00
|
|
|
RainbowMatrixEffectColumn(Window* win, uint8_t dir, bool rnd=false) : MatrixEffectColumn(win, dir, rnd) {};
|
2019-06-16 10:43:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class RandomMatrixEffectColumn : public MatrixEffectColumn {
|
|
|
|
protected:
|
|
|
|
uint8_t _hue = 42;
|
|
|
|
CRGB _getColor(uint8_t height) override;
|
2019-06-19 20:22:03 +00:00
|
|
|
void restart(bool completely_random) override;
|
2019-06-16 10:43:05 +00:00
|
|
|
public:
|
2019-06-19 20:22:03 +00:00
|
|
|
RandomMatrixEffectColumn(Window* win, uint8_t dir, bool rnd=false) : MatrixEffectColumn(win, dir, rnd) {};
|
2019-06-16 10:43:05 +00:00
|
|
|
};
|
|
|
|
|
2019-05-29 22:49:54 +00:00
|
|
|
class MatrixEffect : public Effect {
|
2019-06-16 10:43:05 +00:00
|
|
|
protected:
|
|
|
|
MatrixEffectColumn** _columns;
|
2019-06-07 04:24:16 +00:00
|
|
|
public:
|
2019-05-29 22:49:54 +00:00
|
|
|
boolean can_be_shown_with_clock();
|
|
|
|
MatrixEffect();
|
2019-06-18 16:09:05 +00:00
|
|
|
virtual ~MatrixEffect();
|
2019-05-29 22:49:54 +00:00
|
|
|
void loop();
|
|
|
|
};
|
|
|
|
|
2019-06-16 10:43:05 +00:00
|
|
|
class RainbowMatrixEffect : public MatrixEffect {
|
2019-09-04 04:00:18 +00:00
|
|
|
public:
|
|
|
|
RainbowMatrixEffect();
|
2019-06-16 10:43:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class RandomMatrixEffect : public MatrixEffect {
|
2019-09-04 04:00:18 +00:00
|
|
|
public:
|
|
|
|
RandomMatrixEffect();
|
2019-06-16 10:43:05 +00:00
|
|
|
};
|