I am making rectangles using this simple function:
int render_cell(SDL_Renderer *renderer, int x, int y, const SDL_Color *color) {
SDL_Rect rect;
rect.x = x * CELL_WIDTH;
rect.y = y * CELL_HEIGHT + 30;
rect.w = CELL_HEIGHT;
rect.h = CELL_WIDTH;
SDL_SetRenderDrawColor(renderer, color->r, color->g, color->b, 255);
SDL_RenderDrawRect(renderer, &rect);
SDL_RenderFillRect(renderer, &rect);
}
As a result, I get the rectangles with 'broken' edge on the bottom side:
I have tried avoiding the collision with other objects but this did not make any difference.
Also, the lines are straight as you can see and the other sides of the rectangles are as well.
Here is a google drive link to download my project: you need to navigate to build and type "make" into the terminal and then "./game" and it will run. This will work if you have got CMake https://drive.google.com/file/d/1txmb2IKEYcJOcFSUBVSZyqWyCZQDp2uR/view?usp=sharing