From a6cd94e416a3d94fc5aae4d59dc57e2a498ede85 Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Wed, 4 Sep 2019 06:00:18 +0200 Subject: [PATCH] Fixed rainbow_matrix and random_matrix. --- include/effect_matrix.h | 9 ++++----- src/effect_matrix.cpp | 14 ++++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/include/effect_matrix.h b/include/effect_matrix.h index 2390318..f7793f0 100644 --- a/include/effect_matrix.h +++ b/include/effect_matrix.h @@ -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(); }; diff --git a/src/effect_matrix.cpp b/src/effect_matrix.cpp index 5a400d4..5202043 100644 --- a/src/effect_matrix.cpp +++ b/src/effect_matrix.cpp @@ -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; iwidth]; - _init(); -} - -void MatrixEffect::_init() { for (int i=0; iwidth; i++) _columns[i] = new MatrixEffectColumn(window, MatrixEffectColumn::DIR_SOUTH); } -void RandomMatrixEffect::_init() { +RandomMatrixEffect::RandomMatrixEffect() { + _columns = new MatrixEffectColumn* [window->width]; for (int i=0; iwidth; i++) _columns[i] = new RandomMatrixEffectColumn(window, random8(4), true); } -void RainbowMatrixEffect::_init() { +RainbowMatrixEffect::RainbowMatrixEffect() { + _columns = new MatrixEffectColumn* [window->width]; for (int i=0; iwidth; i++) _columns[i] = new RainbowMatrixEffectColumn(window, MatrixEffectColumn::DIR_SOUTH); }