#include "constants.h" #include "visual.h" void draw_bg(MatrixPanel_I2S_DMA *matrix) { int h_lines = round(PANEL_HEIGHT / 7); int v_lines = round(PANEL_WIDTH / 7); for(int v = 0; v <= v_lines; v++) { matrix->drawFastVLine(v*7+2, 0, PANEL_HEIGHT, matrix->color565(41, 17, 76)); } for(int h = 0; h <= h_lines; h++) { matrix->drawFastHLine(0, 7*h + 1, PANEL_WIDTH, matrix->color565(41, 17, 76)); } } void draw_attractant(MatrixPanel_I2S_DMA *matrix, float attractant[PANEL_WIDTH][PANEL_HEIGHT]) { for(int x = 0; x 15.0) { matrix->drawPixel(x, y, matrix->color565( int((255.0 / 255.0) * round(attractant[x][y])), int((80.0 / 255.0) * round(attractant[x][y])), int((83.0 / 255.0) * round(attractant[x][y])) ) ); } } } } int cleanup_x = 0; bool cleanup(MatrixPanel_I2S_DMA *matrix, int* iterations) { int progress = *iterations - NUM_ITERATIONS; matrix->drawFastVLine(cleanup_x, 0, PANEL_HEIGHT, matrix->color565(254, 242, 255)); if (cleanup_x > 0) { matrix->fillRect(0, 0, cleanup_x, PANEL_HEIGHT, matrix->color565(16, 0, 16)); } int h_lines = round(PANEL_HEIGHT / 7); int v_lines = round(cleanup_x / 7); for(int v = 0; v < cleanup_x; v++) { if (v%7 == 2) { matrix->drawFastVLine(v, 0, PANEL_HEIGHT, matrix->color565(41, 17, 76)); } } for(int h = 0; h <= h_lines; h++) { matrix->drawFastHLine(0, 7*h + 1, cleanup_x-1, matrix->color565(41, 17, 76)); } cleanup_x++; if (cleanup_x > PANEL_WIDTH) { *iterations = 0; cleanup_x = 0; return true; } return false; }