| 128 | int num_rects = 0; |
| 129 | SDL_Rect rects[MAX_RECTS]; |
| 130 | static int |
| 131 | add_rect(int x1, int y1, int x2, int y2) |
| 132 | { |
| 133 | if (num_rects >= MAX_RECTS) |
| 134 | return 0; |
| 135 | if ((x1 == x2) || (y1 == y2)) |
| 136 | return 0; |
| 137 | |
| 138 | if (x1 > x2) |
| 139 | SWAP(int, x1, x2); |
| 140 | if (y1 > y2) |
| 141 | SWAP(int, y1, y2); |
| 142 | |
| 143 | SDL_Log("adding rect (%d, %d), (%d, %d) [%dx%d]\n", x1, y1, x2, y2, |
| 144 | x2 - x1, y2 - y1); |
| 145 | |
| 146 | rects[num_rects].x = x1; |
| 147 | rects[num_rects].y = y1; |
| 148 | rects[num_rects].w = x2 - x1; |
| 149 | rects[num_rects].h = y2 - y1; |
| 150 | |
| 151 | return ++num_rects; |
| 152 | } |
| 153 | |
| 154 | static void |
| 155 | DrawRects(SDL_Renderer * renderer) |