MatrixEffect now uses dynamically allocated memory.
This commit is contained in:
parent
02b3bbcea8
commit
b65afde142
@ -30,9 +30,11 @@ public:
|
|||||||
|
|
||||||
class MatrixEffect : public Effect {
|
class MatrixEffect : public Effect {
|
||||||
private:
|
private:
|
||||||
MatrixEffectColumn columns[LED_WIDTH];
|
MatrixEffectColumn* _columns;
|
||||||
public:
|
public:
|
||||||
boolean can_be_shown_with_clock();
|
boolean can_be_shown_with_clock();
|
||||||
|
void start();
|
||||||
|
void stop();
|
||||||
MatrixEffect();
|
MatrixEffect();
|
||||||
void loop();
|
void loop();
|
||||||
};
|
};
|
||||||
|
@ -55,10 +55,18 @@ void MatrixEffectColumn::loop() {
|
|||||||
boolean MatrixEffect::can_be_shown_with_clock() { return true; };
|
boolean MatrixEffect::can_be_shown_with_clock() { return true; };
|
||||||
|
|
||||||
MatrixEffect::MatrixEffect() {
|
MatrixEffect::MatrixEffect() {
|
||||||
for (int i=0; i<LED_WIDTH; i++) columns[i] = MatrixEffectColumn(window, i);
|
}
|
||||||
|
|
||||||
|
void MatrixEffect::start() {
|
||||||
|
_columns = new MatrixEffectColumn[LED_WIDTH];
|
||||||
|
for (int i=0; i<LED_WIDTH; i++) _columns[i] = MatrixEffectColumn(window, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MatrixEffect::stop() {
|
||||||
|
delete[] _columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatrixEffect::loop() {
|
void MatrixEffect::loop() {
|
||||||
window->clear();
|
window->clear();
|
||||||
for (int i=0; i<window->width; i++) columns[i].loop();
|
for (int i=0; i<window->width; i++) _columns[i].loop();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user