Jump to content
  • Advertisement
Sign in to follow this  
KuroKage

"Flip horizontally" function in DirectDraw ???

This topic is 4916 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

Hi, I just want to ask if there's any way for DirectDraw to simulate a "Flip horizontally" kinda thing wherein the bitmap will be shifted to face the opposite side (a "facing left" sprite will be turned to a "facing right" sprite! Sorry don't know the exact term) so that I won't have to save in another set of sprites just to make everything facing the opposite side. THANKS A LOT IN ADVANCE!!

Share this post


Link to post
Share on other sites
Advertisement
It sounds like you are using individual bitmaps for each position your sprite is in. Why not just use one bitmap with all the positions and then blit from that using source rectangles? That way, you simply have to flip the image in your photo editor then blit from that section of the bitmap.

Share this post


Link to post
Share on other sites
Use the blit effect DDBLTFX_MIRRORLEFTRIGHT.
Quote:
Original post by Rhaal
Why not just use one bitmap with all the positions and then blit from that using source rectangles?
Because you'd waste memory and have to maintain a set of identical sprites.
That's just as bad as repeating code in my book..

Share this post


Link to post
Share on other sites
Hi again,

Thanks for the reply doynax and Rhaal, yes, the reason that I'm not doing what you've said is for memory management reasons (that was actually what I was doing before). But still, thanks.

Anyway my second problem is this. For testing purposes, I made a "turn button" just like in GGXX Isuka so that the character faces opposing sides each time I press it. However, the program slows down everytime it blits the side where I used the DDBLTFX_MIRRORLEFTRIGHT. What was that? I know it's got nothing to do with the code because I never really changed any. I just added that whenever the character faces left (face right is the default), use the DDBLTFX_MIRRORLEFTRIGHT. That's it. I'm totally clueless right now and any insights are very much appreciated.

Share this post


Link to post
Share on other sites
Quote:
Original post by KuroKage
Anyway my second problem is this. For testing purposes, I made a "turn button" just like in GGXX Isuka so that the character faces opposing sides each time I press it. However, the program slows down everytime it blits the side where I used the DDBLTFX_MIRRORLEFTRIGHT. What was that? I know it's got nothing to do with the code because I never really changed any. I just added that whenever the character faces left (face right is the default), use the DDBLTFX_MIRRORLEFTRIGHT. That's it. I'm totally clueless right now and any insights are very much appreciated.
The mirrored blit is probably software emulated and not all that optimized either (hardware ddraw support is poor nowadays).
If it needs to be fast then I recommend that you prerender a flipped version on startup, but that's rarely the case for small character sprites. Then too save video memory you'll have to write some kind of caching system..

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!