Advertisement

How to rotate sprites

Started by February 24, 2000 01:33 PM
3 comments, last by NewDeal 24 years, 6 months ago
Hey What the normal way of doing a sprite rotations - like 45 degrees ? Is this implemented in directx ? Thanx
I seem to recall a similar question just a few days ago. Then I didn''t know DirectDraw could do this and I adviced the guy to do it with Direct3D and rotation matrices. But since then I have looked up the function Blt() in IDirectDrawSurface7, and guess what?

You can rotate a blit with specifying the flag DDBLT_ROTATIONANGLE, and supplying a DDBLTFX structure. In the DDBLTFX structure you set dwRotationAngle to the angle you wish to rotate with.

But if you''re not afraid of using D3D I would recommend doing the rotation by rotating a textured polygon with matrices instead as it will probably be faster. At least if you have a 3D accelerator.
Advertisement
You can use BLTFX to rotate, but as spellbound said, it''s quite slow, and not supported under all graphics cards
either use D3D, or rotate your sprite in a paint program and blt different parts of it according to the angle.
www.cintelsoftware.co.uk
Use the Paint Program. It is the easiest and fastest ay of doing it.
B.t.w: I think www.exaflop.org has Formulas and other stuff for things like that.
I use PSP to draw my starship in different angles and then I just copy rotation code from DX7 SDK example (VB example 4).

This topic is closed to new replies.

Advertisement