Fixed rainbow_matrix and random_matrix.
This commit is contained in:
parent
2ddd77eb5c
commit
a6cd94e416
@ -51,7 +51,6 @@ public:
|
||||
class MatrixEffect : public Effect {
|
||||
protected:
|
||||
MatrixEffectColumn** _columns;
|
||||
virtual void _init();
|
||||
public:
|
||||
boolean can_be_shown_with_clock();
|
||||
MatrixEffect();
|
||||
@ -60,11 +59,11 @@ public:
|
||||
};
|
||||
|
||||
class RainbowMatrixEffect : public MatrixEffect {
|
||||
private:
|
||||
void _init() override;
|
||||
public:
|
||||
RainbowMatrixEffect();
|
||||
};
|
||||
|
||||
class RandomMatrixEffect : public MatrixEffect {
|
||||
private:
|
||||
void _init() override;
|
||||
public:
|
||||
RandomMatrixEffect();
|
||||
};
|
||||
|
@ -69,9 +69,9 @@ void MatrixEffectColumn::draw() {
|
||||
int8_t ydir = 0;
|
||||
switch (_direction) {
|
||||
case DIR_NORTH: ydir = 1; break;
|
||||
case DIR_EAST: xdir = 1; break;
|
||||
case DIR_EAST: xdir = -1; break;
|
||||
case DIR_SOUTH: ydir = -1; break;
|
||||
case DIR_WEST: xdir = -1; break;
|
||||
case DIR_WEST: xdir = 1; break;
|
||||
}
|
||||
for(int i=0; i<length; i++) {
|
||||
CRGB color = _getColor(i);
|
||||
@ -144,18 +144,16 @@ boolean MatrixEffect::can_be_shown_with_clock() { return true; };
|
||||
|
||||
MatrixEffect::MatrixEffect() {
|
||||
_columns = new MatrixEffectColumn* [window->width];
|
||||
_init();
|
||||
}
|
||||
|
||||
void MatrixEffect::_init() {
|
||||
for (int i=0; i<window->width; i++) _columns[i] = new MatrixEffectColumn(window, MatrixEffectColumn::DIR_SOUTH);
|
||||
}
|
||||
|
||||
void RandomMatrixEffect::_init() {
|
||||
RandomMatrixEffect::RandomMatrixEffect() {
|
||||
_columns = new MatrixEffectColumn* [window->width];
|
||||
for (int i=0; i<window->width; i++) _columns[i] = new RandomMatrixEffectColumn(window, random8(4), true);
|
||||
}
|
||||
|
||||
void RainbowMatrixEffect::_init() {
|
||||
RainbowMatrixEffect::RainbowMatrixEffect() {
|
||||
_columns = new MatrixEffectColumn* [window->width];
|
||||
for (int i=0; i<window->width; i++) _columns[i] = new RainbowMatrixEffectColumn(window, MatrixEffectColumn::DIR_SOUTH);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user