Simple sprite flipping in DirectX

Started by
7 comments, last by wise_Guy 23 years, 9 months ago
G''day folks! I''ve been trying to flip my sprite horizontally in DirectX recently and am not sure how to do it. I have tried to just invert the left and right properties of the source and/or dest rectangles, but that don''t seem to work :-( Is there an easy way to do this using directx? Note that I don''t need to rotate the sprites or flip the backbuffer, just flip the sprite along the y axis (horizontally) - to save disk space and only use half as many sprites (less download times). Thanks in advance wise_guy
Advertisement
You can use Blt and pass a DDBLTFX structure with the DDBLTFX_MIRRORUPDOWN flag set. For more info, look up Blt in the SDK.

Hope this helps
VBMaster
oops sorry I mean DDBLTFX_MIRRORLEFTRIGHT...

VBMaster
why don''t you lock the surface and manipulate the data directly?
look for IDirectDrawSurface->Lock() in the documentation.
btw i don''t think mirrored blts are supported by HEL and that means if a user has no videocard that supports it, it won''t be emulated by ddraw, so prolly not the way to go
I would just go ahead and draw the extra sprites beforehand. True, it will mean longer download times but manipulating the data directly like in the post above mine takes time and will slow down your program, especially as your bitmaps get larger.
I would rather take a little longer to download then watch the FPS drop due to my program having to manipulate all the data to flip it


"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
themGames Productions

Hmmm, yeah I might have to save twice as many sprites....

Oh well, thanks for the help
You could manipulate the data directly and store them on surfaces. It just means a few extra milliseconds to load your game.

+AA_970+
or you can flip them once at the begining of the program and save it to an offscreen surface, and blt from that when you want it to be flipped you only get a slight slow down while loading.
after that you wouldnt loose any speed, and you dont have the huge files

Im Always Bored
--Bordem
ICQ: 76947930
Im Always Bored--Bordem ICQ: 76947930
heh guess I waited too long to post got beat to the draw

Im Always Bored
--Bordem
ICQ: 76947930
Im Always Bored--Bordem ICQ: 76947930

This topic is closed to new replies.

Advertisement