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