42 lines
1012 B
C++
42 lines
1012 B
C++
#ifndef FIREWORKSMATRIX_H
|
|
#define FIREWORKSMATRIX_H
|
|
|
|
#include "MatrixAnimation.h"
|
|
|
|
typedef struct _firework_t {
|
|
int16_t xPos;
|
|
int16_t yPos;
|
|
int16_t yMaxHeight;
|
|
uint16_t currentRadius;
|
|
uint16_t radius;
|
|
CRGB color;
|
|
bool isActive;
|
|
} Firework_t;
|
|
|
|
class FireworksMatrix : public MatrixAnimation {
|
|
public:
|
|
FireworksMatrix(LEDHAL2D* _matrix, char* _refName, long _updateTime, CRGB* _colors,
|
|
uint8_t _numColors, uint8_t _maxRadius, uint8_t _maxFireworks) :
|
|
MatrixAnimation(_matrix, _refName, _updateTime), colors(new CRGB[_numColors]),
|
|
numColors(_numColors), maxRadius(_maxRadius), maxFireworks(_maxFireworks) {
|
|
for(uint8_t i = 0; i < _numColors; i++) {
|
|
colors[i] = _colors[i];
|
|
}
|
|
}
|
|
virtual ~FireworksMatrix() { delete[] colors; delete[] fireworks; }
|
|
|
|
void initialize();
|
|
void execute();
|
|
|
|
private:
|
|
uint8_t
|
|
maxFireworks,
|
|
numColors,
|
|
maxRadius;
|
|
CRGB*
|
|
colors;
|
|
Firework_t*
|
|
fireworks;
|
|
};
|
|
|
|
#endif |