I’m writing a card game. I would like to rotate some of the cards 90 degrees and others 270 degrees to represent people sitting to the left and right of me at a table.
void rotate_card (SDL_Rect *dest)
int rot = 90;
src.x = 0;
src.y = 0;
src.w = dest->w;
src.h = dest->h;
SDL_RenderCopyEx (screen, img, &src, dest, rot, NULL, SDL_FLIP_NONE);
The image rotates correctly. Unfortunately, it is stretched and out of proportion.
I have tried adding
dest->w = dest->h;
This keeps the proportions right, but now I have a square card.
I think I’m missing a step, but I’m not sure what it is. Any suggestions?