Hi all.
I've just started to play around with SDL2 and have run into some problems(?) right away. I'm trying to draw a rectangle but it doesn't work as expected. The right side gets shorter than the left one, and there is a gap in the lower right corner. Is this not a good way to draw a rectangle?
Any help would be greatly appreciated.
![](https://uploads.gamedev.net/forums/monthly_2021_10/4721e7b5b0334ba0867cedf289d60954.Screenshot-from-2021-10-22-17-18-30.png)
/* gcc -o sdl-test sdl-test.c `pkg-config --cflags --libs sdl2` */
#include <stdio.h>
#include <stdlib.h>
#include <SDL.h>
int main(int argc, char **argv) {
SDL_Window *win;
SDL_Renderer *rdr;
SDL_Rect rect[] = {
{ 100, 100, 50, 50 },
{ 101, 101, 48, 48 },
{ 102, 102, 46, 46 },
{ 103, 103, 44, 44 },
};
SDL_Init(SDL_INIT_VIDEO);
win = SDL_CreateWindow("Rect", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0);
rdr = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED);
SDL_SetRenderDrawColor(rdr, 0xff, 0xff, 0xff, SDL_ALPHA_OPAQUE);
SDL_RenderDrawRects(rdr, rect, 4);
SDL_RenderPresent(rdr);
SDL_Delay(10000);
return EXIT_SUCCESS;
}