forked from brimshot/quickPatterns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquickPatterns.h
96 lines (65 loc) · 2.06 KB
/
quickPatterns.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef QUICK_PATTERNS_H
#define QUICK_PATTERNS_H
#ifndef QP_INCLUDE_PATTERNS
#define QP_INCLUDE_PATTERNS 1
#endif
#include <Arduino.h>
#include <qpLinkedList.h>
#include <qpColor.h>
#include <qpPattern.h>
#include <qpLayer.h>
#include <qpScene.h>
#include <qpLightStrand.h>
#if QP_INCLUDE_PATTERNS == 1
#include <qpPatternFiles.h>
#endif
/**
*TODO:
* - Shows
* - Scene framerates
* - Fix blend / combine brush
* - Transitions
* - Teensy 3.2 not working with single pattern?
* - Teensy 4.0 support
* - Linked colors
* - Linker fixes
*/
class quickPatterns {
private:
short tickLengthInMillis = 25;
uint32_t nextTickMillis = 0;
qpLightStrand *lightStrand;
qpLinkedList <qpScene> scenes;
int sceneIndex = 0;
qpScene *currentScene = NULL;
qpScene *lastReferencedScene;
public:
quickPatterns(CRGB *leds, int numLeds);
~quickPatterns();
// ~ Rendering
bool draw();
void setTickMillis(int tickLengthMillis) { this->tickLengthInMillis = tickLengthMillis; }
// ~ Config
qpPattern &addPattern(qpPattern *pattern); //creates a new layer and adds passed pattern as pattern 0
// ~ Access
// Patterns
qpPattern &pattern(byte patternIndex); //returns specified pattern on layer 0
// Layers
qpLayer &layer(byte layerIndex);
// Scenes
qpScene &newScene();
qpScene &scene(byte sceneIndex);
// Prev reference
qpScene &sameScene() { return *this->lastReferencedScene; }
qpLayer &sameLayer() { return this->sameScene().sameLayer(); }
qpPattern &samePattern() { return this->sameScene().sameLayer().samePattern(); }
// Quick access operators
qpPattern &operator()(byte layerIndex); //returns pattern 0 from the specified layer in scene 0
qpPattern &operator()(byte sceneIndex, byte layerIndex); //returns pattern 0 from the specified layer in the specified scene
qpPattern &operator()(byte sceneIndex, byte layerIndex, byte patternIndex);
// ~ Scene navigation
void playScene(byte index);
void nextScene();
void playRandomScene();
};
#endif