• Advertisement
Sign in to follow this  

SDL_rotozoom offset

This topic is 4621 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When you rotate an image or scale an image with SDL_rotozoom, the center of the new image is slightly off (to the right and below slightly) To illustrate: http://vicious.sixlabs.org/normal.bmp (regular) http://vicious.sixlabs.org/45.bmp (rotated 45 degrees) The red dot is the center of the image Is there a function that finds the offset of the img (both rotating and zooming the picture), ie, moves the rotated image to the left and upwards so the red dot is at the same location as the red dot is at http://vicious.sixlabs.org/normal.bmp Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
No, the rotation is correct. The problem is that when you rotate it, the size gets bigger according to the rotation. If you rotate a perfect square, it'll turn into a diamond with a larger respective width and height. To fix the problem, instead of drawing at (x, y) draw at (x-width/2, y-height/2). You'll find that it will then draw at the center point of x and y. This is the solution I took when working on Blastoids.

Share this post


Link to post
Share on other sites
Same idea. If you draw it at x-width/2 and y-height/2 then it'll draw the surface centered on what point you give it [smile].

Share this post


Link to post
Share on other sites
Quote:
Original post by Ekim_Gram
What library has SDL_rotzoom?


SDL_gfx

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement