I have written a simple program to display text and image on the SDL Screen. Now I want to rotate them in many orientation. So, Is there any simple method to do it??
Thank a lot.
If someone know anymethod, can you contact me via my email:thuyptt@dsp.com.vn
I am looking forward to hearing from you!!
How to rotate text or image using SDL??
Started by nicequeenbee, Nov 27 2005 08:56 PM
11 replies to this topic
Sponsor:
#3 Moderators - Reputation: 1500
Posted 28 November 2005 - 03:33 AM
SDL_gfx has a nice little method called rotozoomSurface that rotates a surface as well as optionally enlarges it. Although software rotations are slow, they do work. Just make sure to cache all your rotated surfaces instead of rotating them in realtime.
#4 Members - Reputation: 122
Posted 28 November 2005 - 12:53 PM
Hi all,
Thanks so much for your answers. I have downed load SDL_gfx, but I think it is so complex for me to understand. By the way, is rotating an image different to rotating a string on screen. I realized that SDL_gfx just support for rotating an image. Is there another way????
Thanks
Thanks so much for your answers. I have downed load SDL_gfx, but I think it is so complex for me to understand. By the way, is rotating an image different to rotating a string on screen. I realized that SDL_gfx just support for rotating an image. Is there another way????
Thanks
#6 Anonymous Poster_Anonymous Poster_* Guests - Reputation:
Posted 28 November 2005 - 03:50 PM
Look at the sample programs that come with SDL_gfx
#9 Members - Reputation: 1691
Posted 28 November 2005 - 04:47 PM
Quote:
Is there another way?
Other than using the means mentioned above, your only choice left would be to write your own little library to do this, and in the end you will end up with just the same thing as SDL_gfx, so you might as well use that. As was mentioned by Rob, pre-generate everything in the beginning and store that (cache) rather than try to do it in realtime, because your app will take some *major* performance hits. Sure it takes up more memory, but it's well worth the trade-off if possible.
#10 Members - Reputation: 535
Posted 29 November 2005 - 08:48 AM
Quote:
Original post by nicequeenbee
Hi all,
Thanks so much for your answers. I have downed load SDL_gfx, but I think it is so complex for me to understand. By the way, is rotating an image different to rotating a string on screen. I realized that SDL_gfx just support for rotating an image. Is there another way????
Thanks
It might be far less complicated that it seems at first sight. I mean, even I could get it working.[grin] You just need the SDL_rotozoom part of SDL_gfx, which are three functions iirc, and you might even use only one of those. You could just add the SDL_Rotozoom.c and SDL_rotozoom.h to your project (remove all the references to DLLINTERFACE), no need to build a dll. (Your code becomes LGPL i think, but that might not be such a problem). As for the strings on the screen, those are actually images. SDL_ttf takes strings and converts them to surfaces, so you can use rotozoom for those if you use SDL_ttf.
#11 Anonymous Poster_Anonymous Poster_* Guests - Reputation:
Posted 30 November 2005 - 12:20 AM
Hi all,
I have added SDL_rotozoom.h and SDL_rotozoom.cpp into my project, but I met mistake when trying to use the function SDL_Surface *rotozoomSurface(SDL_Surface * src, double angle, double zoom, int smooth), I can't correct it because it just give a message box and give the mistake of memory.
If I give 0.0 for the parameter angle, it's correct, but it's just correct with the value 0.0. Is there any answer for that
Thank for your help :)
I have added SDL_rotozoom.h and SDL_rotozoom.cpp into my project, but I met mistake when trying to use the function SDL_Surface *rotozoomSurface(SDL_Surface * src, double angle, double zoom, int smooth), I can't correct it because it just give a message box and give the mistake of memory.
If I give 0.0 for the parameter angle, it's correct, but it's just correct with the value 0.0. Is there any answer for that
Thank for your help :)







