Re: Rotating texture with even dimensions by 90 degree
"stewambo" <[email protected]>
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <[email protected]> |
Am i really the first and only one with this problem? Or am I or my code the problem?
Just to give as much information as possible, here is the original image and the code, which created the (zoomed in) example image on the original post:
[Image: http://i.imgur.com/W8iHtgA.png ]
Code:
SDL_Surface* rotationTestSurface = IMG_Load("rotationTest.png");
SDL_Texture* rotationTestTexture = SDL_CreateTextureFromSurface(renderer, rotationTestSurface);
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 100);
for (int i = 0; i < 4; i++) {
SDL_Rect drawRect{ 100,100+i*15,10,10 };
SDL_RenderCopyEx(renderer, rotationTestTexture, NULL, &drawRect, i*90, NULL, SDL_FLIP_NONE);
SDL_RenderDrawRect(renderer, &drawRect);
}
And here is why this (erroneous) behavior is a big problem for me. I'm making a turn and grid based game. The red square is the player and the black line is it's movement path, which looks horrible because of the incorrect rotations of the single pieces (straights and corners):
[Image: http://i.imgur.com/GnSzYBi.png ] [Image: http://i.imgur.com/tlvF3Ir.png ]
[Image: http://i.imgur.com/wdV6sLC.png ]
Hopefully i get some answers now, even if it's just other users with the same problem.
Thanks and best regards,
Stefan
_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org