MatrixEffect now uses dynamically allocated memory.
This commit is contained in:
parent
02b3bbcea8
commit
b65afde142
@ -30,9 +30,11 @@ public:
|
||||
|
||||
class MatrixEffect : public Effect {
|
||||
private:
|
||||
MatrixEffectColumn columns[LED_WIDTH];
|
||||
MatrixEffectColumn* _columns;
|
||||
public:
|
||||
boolean can_be_shown_with_clock();
|
||||
void start();
|
||||
void stop();
|
||||
MatrixEffect();
|
||||
void loop();
|
||||
};
|
||||
|
@ -55,10 +55,18 @@ void MatrixEffectColumn::loop() {
|
||||
boolean MatrixEffect::can_be_shown_with_clock() { return true; };
|
||||
|
||||
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() {
|
||||
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