fix up some things, it flickers sometimes now??
This commit is contained in:
parent
7b152d4025
commit
8d51a0a036
@ -24,7 +24,7 @@ bool rain_initialized = false;
|
|||||||
uint16_t color_highlight;
|
uint16_t color_highlight;
|
||||||
uint16_t color_default;
|
uint16_t color_default;
|
||||||
|
|
||||||
void setup_rain() {
|
void setup_rain(MatrixPanel_I2S_DMA *matrix) {
|
||||||
color_highlight = matrix->color565(
|
color_highlight = matrix->color565(
|
||||||
COLOR_HIGHLIGHT_R,
|
COLOR_HIGHLIGHT_R,
|
||||||
COLOR_HIGHLIGHT_G,
|
COLOR_HIGHLIGHT_G,
|
||||||
@ -46,7 +46,7 @@ void setup_rain() {
|
|||||||
void draw_rain(MatrixPanel_I2S_DMA *matrix, Mode mode) {
|
void draw_rain(MatrixPanel_I2S_DMA *matrix, Mode mode) {
|
||||||
//matrix ->drawBitmap(0, 0, overlay, 64, 32, matrix->color565(64, 0, 0));
|
//matrix ->drawBitmap(0, 0, overlay, 64, 32, matrix->color565(64, 0, 0));
|
||||||
if (!rain_initialized) {
|
if (!rain_initialized) {
|
||||||
setup_rain();
|
setup_rain(matrix);
|
||||||
rain_initialized = true;
|
rain_initialized = true;
|
||||||
}
|
}
|
||||||
unsigned long timestamp = millis();
|
unsigned long timestamp = millis();
|
||||||
@ -66,7 +66,7 @@ void draw_rain(MatrixPanel_I2S_DMA *matrix, Mode mode) {
|
|||||||
// draw our trail
|
// draw our trail
|
||||||
for (int trail_offset = 1; trail_offset < raindrops[x].length; trail_offset++) {
|
for (int trail_offset = 1; trail_offset < raindrops[x].length; trail_offset++) {
|
||||||
int trail_y = raindrops[x].y - trail_offset;
|
int trail_y = raindrops[x].y - trail_offset;
|
||||||
float brightness = (raindrops[x].length - trail_offset);
|
float brightness = ((raindrops[x].length - trail_offset) / (float)raindrops[x].length);
|
||||||
uint16_t fade_color = matrix->color565(
|
uint16_t fade_color = matrix->color565(
|
||||||
COLOR_DEFAULT_R * brightness,
|
COLOR_DEFAULT_R * brightness,
|
||||||
COLOR_DEFAULT_G * brightness,
|
COLOR_DEFAULT_G * brightness,
|
||||||
@ -75,10 +75,10 @@ void draw_rain(MatrixPanel_I2S_DMA *matrix, Mode mode) {
|
|||||||
|
|
||||||
if (trail_y < 0) {
|
if (trail_y < 0) {
|
||||||
if (not raindrops[x].reached_bottom) {
|
if (not raindrops[x].reached_bottom) {
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
// we need to count from the bottom up
|
// we need to count from the bottom up
|
||||||
trail_y = PANEL_WIDTH + trail_y;
|
trail_y = PANEL_HEIGHT + trail_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pixel_num = (trail_y * PANEL_WIDTH) + x;
|
int pixel_num = (trail_y * PANEL_WIDTH) + x;
|
||||||
@ -95,27 +95,6 @@ void draw_rain(MatrixPanel_I2S_DMA *matrix, Mode mode) {
|
|||||||
} else {
|
} else {
|
||||||
matrix->drawPixel(x, trail_y, fade_color);
|
matrix->drawPixel(x, trail_y, fade_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
//} else if (raindrops[x].reached_bottom) {
|
|
||||||
// int pixel_num = ((PANEL_HEIGHT + trail_y) * PANEL_WIDTH) + x;
|
|
||||||
// if (raindrops[x].y >= 0) {
|
|
||||||
// if (overlay[ pixel_num / 8 ] & (1 << (7 - (pixel_num % 8)) ) and mode != Stealth) {
|
|
||||||
// if (mode == HighVis) {
|
|
||||||
// matrix->drawPixel(x, PANEL_HEIGHT + trail_y, color_highlight);
|
|
||||||
// } else {
|
|
||||||
// matrix->drawPixel(x, PANEL_HEIGHT + trail_y, matrix->color565(
|
|
||||||
// COLOR_HIGHLIGHT_R * brightness,
|
|
||||||
// COLOR_HIGHLIGHT_G * brightness,
|
|
||||||
// COLOR_HIGHLIGHT_B * brightness
|
|
||||||
// ));
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// matrix->drawPixel(x, PANEL_HEIGHT + trail_y, matrix->color565(0, fade_color, 0));
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user