• Advertisement

Archived

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

Simple sprite flipping in DirectX

This topic is 6418 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites
Hmmm, yeah I might have to save twice as many sprites....

Oh well, thanks for the help

Share this post


Link to post
Share on other sites
You could manipulate the data directly and store them on surfaces. It just means a few extra milliseconds to load your game.

+AA_970+

Share this post


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

Share this post


Link to post
Share on other sites
heh guess I waited too long to post got beat to the draw

Im Always Bored
--Bordem
ICQ: 76947930

Share this post


Link to post
Share on other sites

  • Advertisement