You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
839 B
36 lines
839 B
void drawRects(int step){
|
|
|
|
SDL_RenderClear(renderer);
|
|
|
|
int cols = matrix[1];
|
|
int rows = matrix[0];
|
|
int colWidth = ((600-5)/cols)-5;
|
|
int rowHeight = ((300-5)/rows)-5;
|
|
|
|
for(int i=0; i<rows; i++) {
|
|
for(int y=0; y<cols; y++) {
|
|
SDL_Rect rect;
|
|
rect.x = (colWidth+5)*y+5;
|
|
rect.y = (rowHeight+5)*i+5;
|
|
rect.w = colWidth;
|
|
rect.h = rowHeight;
|
|
|
|
if(pattern[i][y] == 1) {
|
|
SDL_SetRenderDrawColor(renderer, 50, 255, 50, 255);
|
|
} else {
|
|
SDL_SetRenderDrawColor(renderer, 50, 50, 50, 255);
|
|
}
|
|
SDL_RenderFillRect(renderer, &rect);
|
|
|
|
if(step == y) {
|
|
SDL_SetRenderDrawColor(renderer, 200, 200, 200, 255);
|
|
SDL_RenderDrawRect(renderer, &rect);
|
|
}
|
|
|
|
SDL_SetRenderDrawColor(renderer, 100, 100, 100, 255);
|
|
}
|
|
}
|
|
|
|
SDL_RenderPresent(renderer);
|
|
}
|
|
|