This topic is now archived and is closed to further replies.


[DirectDraw] Problem with the rotation FX

Recommended Posts

Alload    122
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?

Share this post

Link to post
Share on other sites
Tornado    122

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

Share this post

Link to post
Share on other sites
S1CA    1418
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

Share this post

Link to post
Share on other sites