mirror of
https://github.com/alopexc0de/pixopixel.git
synced 2024-12-25 14:32:40 +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:
|
||||
* - pxl[TOTALPXLS][3] - Standard Pixol image
|
||||
* - 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) {
|
||||
matrix.fillScreen(0);
|
||||
void showPxl(int pxl[TOTALPXLS][3], int dlytime, bool color=false) {
|
||||
resetActiveState();
|
||||
|
||||
for (int i=0; i<256; i++){
|
||||
matrix.setPixelColor(i, pxl[i][0], pxl[i][1], pxl[i][2]);
|
||||
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]);
|
||||
}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();
|
||||
|
Loading…
Reference in New Issue
Block a user