Jump to content
  • Advertisement

Archived

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

gameprogrammerwiz

loading bitmaps with loop

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

ok, i actually got something in directdraw to work! does anybody know what temperature it is in hell? must be cold down there. ;] ok, here''s my problem: i can load a bitmap just fine, and i can load multiple bitmaps just fine...but when i try to load multiple bitmaps with a loop, my program freezes. my loop code: ============= case VK_F1: tilex = 0; tiley = 0; while(a <= 5) { lpDDSPrimary->BltFast( tilex, tiley, lpDDSmainbg, NULL, DDBLTFAST_WAIT / DDBLTFAST_SRCCOLORKEY ); tilex = tilex + 95; } } break; that diplays five tiles, and then freezes. but if i do it like this: ========================= lpDDSPrimary->BltFast( tilex, tiley, lpDDSmainbg, NULL, DDBLTFAST_WAIT / DDBLTFAST_SRCCOLORKEY ); tilex = tilex + 95; lpDDSPrimary->BltFast( tilex, tiley, lpDDSmainbg, NULL, DDBLTFAST_WAIT / DDBLTFAST_SRCCOLORKEY ); tilex = tilex + 95; lpDDSPrimary->BltFast( tilex, tiley, lpDDSmainbg, NULL, DDBLTFAST_WAIT / DDBLTFAST_SRCCOLORKEY ); tilex = tilex + 95; lpDDSPrimary->BltFast( tilex, tiley, lpDDSmainbg, NULL, DDBLTFAST_WAIT / DDBLTFAST_SRCCOLORKEY ); tilex = tilex + 95; lpDDSPrimary->BltFast( tilex, tiley, lpDDSmainbg, NULL, DDBLTFAST_WAIT / DDBLTFAST_SRCCOLORKEY ); tilex = tilex + 95; that loads five tiles, but doesnt freeze. hmm. whats wrong? it must be with the loop. i also tryed a for loop, but that froze too.

Share this post


Link to post
Share on other sites
Advertisement
It should be:

while(a <= 5)
{
lpDDSPrimary->BltFast( tilex, tiley, lpDDSmainbg, NULL, DDBLTFAST_WAIT / DDBLTFAST_SRCCOLORKEY );
tilex = tilex + 95;
a++;
}
}
break;

See that I added "a++", otherwise "a" will always be <= 5.

/. Muzzafarath

Share this post


Link to post
Share on other sites
yeah, without the a++, the loop is infinite.
the most probable reason it draws five and then messes up is that tilex probable becomes greater than the screen size, and tries to blit to an impossible area.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!