Tilting or rotating an image

Say you load an image such as a jpg file. How would one go about rotating the
image left or right? Thanks for any info provided.

Have a look at SDL_rotozoom

You’re better off pre-rendering the rotated image rather than doing it on the fly, in my experience…

Ed> ----- Original Message -----

From: armond.sarkisian@gmail.com (Armond Sarkisian)
To: sdl at libsdl.org
Sent: Friday, 25 July, 2008 5:12:52 PM
Subject: [SDL] Tilting or rotating an image

Say you load an image such as a jpg file. How would one go about rotating the
image left or right? Thanks for any info provided.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

  __________________________________________________________

Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html

Assuming some common setup and variables…

Sint16 x = 40, y = 100;
float angle = 90;

SDL_Surface* pic = IMG_Load(“filename.jpg”);
SDL_Surface* rotated = SPG_Rotate(pic, angle, 0x000000);

SDL_Rect dest = SPG_MakeRect(x, y, 1, 1);
SDL_BlitSurface(rotated, NULL, screen, &dest);
SDL_Flip(screen);

SDL_FreeSurface(pic);
SDL_FreeSurface(rotated);

Jonny D----------------------------------------

To: sdl at libsdl.org
From: armond.sarkisian at gmail.com
Date: Fri, 25 Jul 2008 16:12:52 +0000
Subject: [SDL] Tilting or rotating an image

Say you load an image such as a jpg file. How would one go about rotating the
image left or right? Thanks for any info provided.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org