Rotating sprites

Is there a function for this?

Herbert__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

Not in SDL itself. There’s an external lib that handles it.
(For the life of me, I can’t remember it’s name.)

See the Libraries page on www.libsdl.org

Good luck!

-bill!
http://www.newbreedsoftware.com/bill/On Wed, Dec 05, 2001 at 02:50:52PM -0800, Red wrote:

Is there a function for this?

It’s called SDL_rotozoom

http://www.ferzkopp.net/Software/SDL_rotozoom/

It’s an excellent library. Works really well.

Cheers> ----- Original Message -----

From: William Kendrick [mailto:nbs@sonic.net]
Sent: Thursday, 6 December 2001 11:04 AM
To: sdl at libsdl.org
Subject: Re: [SDL] Rotating sprites

On Wed, Dec 05, 2001 at 02:50:52PM -0800, Red wrote:

Is there a function for this?

Not in SDL itself. There’s an external lib that handles it.
(For the life of me, I can’t remember it’s name.)

See the Libraries page on www.libsdl.org

Good luck!

-bill!
http://www.newbreedsoftware.com/bill/


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.303 / Virus Database: 164 - Release Date: 24/11/2001


Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.303 / Virus Database: 164 - Release Date: 24/11/2001


IMPORTANT: This e-mail, including any attachments, may contain private or
confidential information. If you think you may not be the intended
recipient, or if you have received this e-mail in error, please contact the
sender immediately and delete all copies of this e-mail. If you are not the
intended recipient, you must not reproduce any part of this e-mail or
disclose its contents to any other party.


I’m writing a game with a small car in it. The car rotates when you
press the arrow keys.

Currently I have 16 sprites to give varying degrees of rotation. I blit
the required one to the screen.

Would using the SDL_rotozoom/SDL_gfx library to rotate a base sprite by
be any slower? I’m having problems aligning the sprites up so they look
nice when rotated, and the animation looks jerky with only 16 frames.

The sprites are only 16x16 pixels…–
Organ transplants are best left to professionals

6AD6 865A BF6E 76BB 1FC2 | www.piku.org.uk/public-key.asc
E4C4 DEEA 7D08 D511 E149 | www.piku.org.uk wnzrf at cvxh.bet.hx (rot13’d)

I’m writing a game with a small car in it. The car rotates when you
press the arrow keys.

Currently I have 16 sprites to give varying degrees of rotation. I blit
the required one to the screen.

Would using the SDL_rotozoom/SDL_gfx library to rotate a base sprite by
be any slower? I’m having problems aligning the sprites up so they look
nice when rotated, and the animation looks jerky with only 16 frames.

The sprites are only 16x16 pixels…

you can always prerender them on apps start :slight_smile:
i am fe using opengl accelerated card to prerender blur on rectangles. I am
using those for games like allways hot, beattle mania, and others…

you can even enable AA for that.

GJ.

Use rotozoom to generate all the images required on startup.
Don’t dynamically generate the images as the game is running.

All spped optimizations are an effort in caching.

James wrote:> I’m writing a game with a small car in it. The car rotates when you

press the arrow keys.

Currently I have 16 sprites to give varying degrees of rotation. I blit
the required one to the screen.

Would using the SDL_rotozoom/SDL_gfx library to rotate a base sprite by
be any slower? I’m having problems aligning the sprites up so they look
nice when rotated, and the animation looks jerky with only 16 frames.

The sprites are only 16x16 pixels…

|
| > I’m writing a game with a small car in it. The car rotates when you
| > press the arrow keys.
| >
| > Currently I have 16 sprites to give varying degrees of rotation. I blit
| > the required one to the screen.
| >
| > Would using the SDL_rotozoom/SDL_gfx library to rotate a base sprite by
| > be any slower? I’m having problems aligning the sprites up so they look
| > nice when rotated, and the animation looks jerky with only 16 frames.
| >
| > The sprites are only 16x16 pixels…
|
| you can always prerender them on apps start :slight_smile:

Aah… that’d work… Rotating a sprite every time the user moved might
be slow, but I doubt they’d notice a 2 second delay while I prerendered
a few dozen sprites.

Or I could write a generator that took a base sprite and spat out a PNG
or something containing the rotated sprites, then load that as usual.

I like game programming. It’s all a big trick to see what you can get
away with :-)On Fri, May 31, 2002 at 03:04:18AM +0200, Grzegorz Jaskiewicz wrote:


This punishment is not boring and pointless

6AD6 865A BF6E 76BB 1FC2 | www.piku.org.uk/public-key.asc
E4C4 DEEA 7D08 D511 E149 | www.piku.org.uk wnzrf at cvxh.bet.hx (rot13’d)

Hello James,

Friday, May 31, 2002, 01:53:36, you wrote:

J> Would using the SDL_rotozoom/SDL_gfx library to rotate a base sprite by
J> be any slower? I’m having problems aligning the sprites up so they look
J> nice when rotated, and the animation looks jerky with only 16 frames.

J> The sprites are only 16x16 pixels…

I use SDL_rotozoom for sprite rotation, but it has a bug(?) inside,
cause the sprite changes it offset and looks like jumping ball when you rotate it fast. Ive made a little walk around, changing sprite offset by 1-2 pixels
in X and Y-direction for every angle.
i.e
switch(angle)
{
case 0:
case 360:
ox = 0;
oy = 0;
break;

case 15:
ox = 1;
oy = 0;

}

then rotozoom. It looks more or less nice :)–
Best regards,
Alexander mailto:Editor at echo.ru

I think the best way to do it is to simply prerender the sprites (rotate
them in Gimp or Photoshop) and throw them all in one big picture file.
You can then load that entire picture file strip onto a surface, and
blit just the portions you need. It seems to work great for the game I’m
making right now, but if you’re doing full 360 degrees of rotation, at
least in my personal opinion, I think at least 36 frames looks good.On Thu, 2002-05-30 at 17:53, James wrote:

I’m writing a game with a small car in it. The car rotates when you
press the arrow keys.

Currently I have 16 sprites to give varying degrees of rotation. I blit
the required one to the screen.

Would using the SDL_rotozoom/SDL_gfx library to rotate a base sprite by
be any slower? I’m having problems aligning the sprites up so they look
nice when rotated, and the animation looks jerky with only 16 frames.

The sprites are only 16x16 pixels…


Organ transplants are best left to professionals

6AD6 865A BF6E 76BB 1FC2 | www.piku.org.uk/public-key.asc
E4C4 DEEA 7D08 D511 E149 | www.piku.org.uk wnzrf at cvxh.bet.hx (rot13’d)


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Chris
@Christopher_Thielen

Hi to all,

The developpers of the game Trophy (using Clanlib ;_( ) provide GIMP

scripts for that purpose at
http://trophy.sourceforge.net/index.php3?body=developers_corner.

Best Regards,
^IoDream^> ----- Original Message -----

From: chris@luethy.net (Christopher Thielen)
To:
Sent: Saturday, June 01, 2002 2:07 AM
Subject: Re: [SDL] Rotating sprites

I think the best way to do it is to simply prerender the sprites (rotate
them in Gimp or Photoshop) and throw them all in one big picture file.
You can then load that entire picture file strip onto a surface, and
blit just the portions you need. It seems to work great for the game I’m
making right now, but if you’re doing full 360 degrees of rotation, at
least in my personal opinion, I think at least 36 frames looks good.

On Thu, 2002-05-30 at 17:53, James wrote:

I’m writing a game with a small car in it. The car rotates when you
press the arrow keys.

Currently I have 16 sprites to give varying degrees of rotation. I blit
the required one to the screen.

Would using the SDL_rotozoom/SDL_gfx library to rotate a base sprite
by

be any slower? I’m having problems aligning the sprites up so they look
nice when rotated, and the animation looks jerky with only 16 frames.

The sprites are only 16x16 pixels…


Organ transplants are best left to professionals

6AD6 865A BF6E 76BB 1FC2 | www.piku.org.uk/public-key.asc
E4C4 DEEA 7D08 D511 E149 | www.piku.org.uk wnzrf at cvxh.bet.hx (rot13’d)


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Chris
chris at luethy.net


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


ifrance.com, l’email gratuit le plus complet de l’Internet !
vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP…
http://www.ifrance.com/_reloc/email.emailif

| Hi to all,
|
| The developpers of the game Trophy (using Clanlib ;_( ) provide GIMP
| scripts for that purpose at
| http://trophy.sourceforge.net/index.php3?body=developers_corner.

I think we’ll forgive them for using ClanLib this time… that looks
like the kind of thing I was after :slight_smile: Now if only I could draw sprites!On Sat, Jun 08, 2002 at 09:27:09PM +0200, IoDream wrote:


No-one is interested in my underpants

6AD6 865A BF6E 76BB 1FC2 | www.piku.org.uk/public-key.asc
E4C4 DEEA 7D08 D511 E149 | www.piku.org.uk wnzrf at cvxh.bet.hx (rot13’d)

Are there any SDL add-on libraries capable of rotating graphic objects
on the fly? It would be nice to need only a single graphic for a sprite
and to get smooth rotation. If no library exists then what’s a good
online source for this algorithm, or do you know it yourself?

I can see how you’d mathematically rotate each pixel to its new
position in the image (and its alpha channel), but it seems like a lot
of math for every frame, which I’d like to avoid if there’s an
optimized method. My program needs to render lots of sprites as fast as
possible.

Somehow I think sticking textures on rectangles in GL space will end up
being the most elegant solution, as long as alpha blending is supported.–
Scott Lahteine, World Traveler


Scott Lahteine, Code Cruncher
scott at criticalpath.com
Critical Path Software, Portland OR
(503) 265-1235

Are there any SDL add-on libraries capable of rotating graphic objects
on the fly? It would be nice to need only a single graphic for a sprite
and to get smooth rotation. If no library exists then what’s a good
online source for this algorithm, or do you know it yourself?

I can see how you’d mathematically rotate each pixel to its new
position in the image (and its alpha channel), but it seems like a lot
of math for every frame, which I’d like to avoid if there’s an
optimized method. My program needs to render lots of sprites as fast as
possible.

Somehow I think sticking textures on rectangles in GL space will end up
being the most elegant solution, as long as alpha blending is supported.–
Scott Lahteine, World Traveler


Scott Lahteine, Code Cruncher
scott at criticalpath.com
Critical Path Software, Portland OR
(503) 265-1235

Rotating each pixel is alot of work to do each frame, but you could always
rotate it at the begining and store the rotated pictures in memory.> ----- Original Message -----

From: slur@qwest.net (Scott Lahteine)
To:
Sent: Monday, September 23, 2002 11:11 AM
Subject: [SDL] Rotating sprites

Are there any SDL add-on libraries capable of rotating graphic objects
on the fly? It would be nice to need only a single graphic for a sprite
and to get smooth rotation. If no library exists then what’s a good
online source for this algorithm, or do you know it yourself?

I can see how you’d mathematically rotate each pixel to its new
position in the image (and its alpha channel), but it seems like a lot
of math for every frame, which I’d like to avoid if there’s an
optimized method. My program needs to render lots of sprites as fast as
possible.

Somehow I think sticking textures on rectangles in GL space will end up
being the most elegant solution, as long as alpha blending is supported.


Scott Lahteine, World Traveler


Scott Lahteine, Code Cruncher
scott at criticalpath.com
Critical Path Software, Portland OR
(503) 265-1235


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

rotozoom, which I think became the basis of SGE

Load up the “Libraries” page on www.libsdl.org and do a 'find-in-page’
for the string “rotat” in your web browser.

Good luck!

-bill!On Mon, Sep 23, 2002 at 11:12:58AM -0700, Scott Lahteine wrote:

Are there any SDL add-on libraries capable of rotating graphic objects
on the fly? It would be nice to need only a single graphic for a sprite
and to get smooth rotation. If no library exists then what’s a good
online source for this algorithm, or do you know it yourself?

Scott Lahteine:

Are there any SDL add-on libraries capable of rotating graphic objects
on the fly?

Take also a look at Kira, in the SDL libraries.

Regards,
Francesco Orsenigo, Xarvh Project

Alan Wolfe wrote:

Rotating each pixel is alot of work to do each frame, but you could always
rotate it at the begining and store the rotated pictures in memory.

There is a very old article at http://gameprogrammer.com/5-poly.html
IIRC it details how to draw a polygon and how to draw a rotated 2d
textured polygon. Which is all you need to rotate an image on the fly.
The code is so old that it is all written using fixed point arithmetic.

Even though I wrote the article, it has been 9 years since I looked at
but you might find both the article and the code to be of value. I
really ought to get that old code working with SDL. The code was derived
from code written for a commercial game that was intended to run on a
33Mhz 486sx and do rotations every frame. Sadly, the game was canceled
at about the 80% complete phase.

	Bob Pendleton-- 

±-----------------------------------+

rotozoom, which I think became the basis of SGE

Load up the “Libraries” page on www.libsdl.org and do a 'find-in-page’
for the string “rotat” in your web browser.

Rotozoom is part of SDL_gfx now, which you can find on the libraries page.
It works well, but I decided to use OpenGL, and i’m in the process of
writing an engine, which will be faster still.

  • Andy Livingstone