6 changed files with 55 additions and 9 deletions
			
			
		| @ -0,0 +1,36 @@ | |||||
|  | 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); | ||||
|  | } | ||||
|  | 
 | ||||
								
									Binary file not shown.
								
							
						
					
					Loading…
					
					
				
		Reference in new issue