[DirectDraw] Problem with the rotation FX

Started by
2 comments, last by Alload 22 years, 9 months ago
I tried to rotate a sprite but it doesn''t work. Here''s the code: int angle = 0; DDBLTFX ddbltfx; ddbltfx.dwSize = sizeof(ddbltfx); ddbltfx.dwRotationAngle = angle; angle = angle + 5; lpSecondary->Blt(&destrect, lpSStarship, &srcrect, DDBLT_WAIT | DDBLT_KEYSRC, &ddbltfx); What''s the problem? How can I rotate this sprite?
Advertisement
Try:

lpSecondary->Blt(&destrect, lpSStarship, &srcrect, DDBLT_WAIT | DDBLT_KEYSRC | DDBLT_ROTATIONANGLE, &ddbltfx);

Just remember that rotation doesn''t work on a lot of video cards, so it might not work on yours.


- Goblineye Entertainment
The road to success is always under construction
Goblineye EntertainmentThe road to success is always under construction
Almost if not all graphics cards do not support rotated blits. It isn''t emulated either. If you check the caps bits for both the HAL and HEL you''ll find that you don''t have rotation available.

If you want arbitrary rotations you need to either:

a. lock the surface and do it yourself - slow and extra pixel work, but guaranteed to work on anything.

b. Use a 3D API and treat the sprite as a textured square - this is really fast and will work on all graphics cards made from 1997 onwards (and some earlier). Look at the D3DX helper library which comes in the SDK - it has a sprite implemented this way.

b is my preferred option by a long way, and not much more work than locking and doing it yourself.

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Or better still, use my D3D-2D wrapper available on my site,
click the link below.

  Game Download  ZeroOne Realm

  Downloads:  ZeroOne Realm

This topic is closed to new replies.

Advertisement