mirror of
https://github.com/alopexc0de/pixopixel.git
synced 2024-11-14 23:27:25 +00:00
Add optional color selection defined via the PXL structure
This can be useful for using the same icon with a different color to indicate various states
This commit is contained in:
parent
7073d2d3f2
commit
ba7598c750
@ -62,12 +62,26 @@ void resetActiveState() {
|
|||||||
* args:
|
* args:
|
||||||
* - pxl[TOTALPXLS][3] - Standard Pixol image
|
* - pxl[TOTALPXLS][3] - Standard Pixol image
|
||||||
* - dlytime - The amount of time (in ms) to keep the image on the display
|
* - dlytime - The amount of time (in ms) to keep the image on the display
|
||||||
|
* - color (optional) - Whether or not to set the active pixel's color to its stored value
|
||||||
*/
|
*/
|
||||||
void showPxl(int pxl[256][3], int dlytime) {
|
void showPxl(int pxl[TOTALPXLS][3], int dlytime, bool color=false) {
|
||||||
matrix.fillScreen(0);
|
resetActiveState();
|
||||||
|
|
||||||
for (int i=0; i<256; i++){
|
for (int i=0; i < TOTALPXLS; i++){
|
||||||
|
if (pxl[i][0] != 0 && pxl[i][1] != 0 && pxl[i][2] != 0) {
|
||||||
|
pixols[i].active = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!color) {
|
||||||
matrix.setPixelColor(i, pxl[i][0], pxl[i][1], pxl[i][2]);
|
matrix.setPixelColor(i, pxl[i][0], pxl[i][1], pxl[i][2]);
|
||||||
|
}else {
|
||||||
|
if (pixols[i].active) {
|
||||||
|
matrix.setPixelColor(i, pxl[i][pixols[i].r],
|
||||||
|
pxl[i][pixols[i].g],
|
||||||
|
pxl[i][pixols[i].b]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
matrix.show();
|
matrix.show();
|
||||||
|
Loading…
Reference in New Issue
Block a user