c++ - Best way to rotate an image using SDL? -


I am creating a game and the hand of the main character will follow the mouse cursor, so it will rotate very often . What will be the best way to rotate it?

With SDL you have a few options.

  1. Rotate all your sprites in advance (pre-render all possible rotations) and present them as if you have any other phantom this approach is faster, but more memory and more Uses sprites As stated, phantom is a great tool for making transformations.

  2. Use something to do real-time rotation / zooming. (Not recommended, too slow)

  3. Use SDL in OpenGL mode and submit your Phantom to the archives to apply rotation. Option 3 is probably your best bet because you gain all the benefits of using OpenGL. It really depends on you how to do it. It is also a possibility that you can load your sprites, calculate all the rotation with SDL_gfx, and then save the rotated versions to SDL_Surface in memory.

    EDIT: In response to your comment I have Lazyfoo's SDL tutorals. . There is also one, which can be useful in your case. A quick search was brought back which could be useful.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -