Sign in to follow this  
Reilz

Dx FLip() question

Recommended Posts

so i've been working my way through the DDraw stuff i have, and i'm doen Bliting so i figure hey, why not try and do a little something outside the book that might pass for a game(just soemthign simple to make sure i understand everything i've done so far). i thought i'd make a pong look alike(though i'd need to get soem colision detection and physics info first, but that's another story and i think i could come up with soemthign crude on my own at the very least anyway, i am trying toi figure out how to redraw the frame. the way i figured ti i draw a rect, and then if the user hits the up arrow i change the y coordanet and that redraws the "paddle" in a new place. now th issue is my book hasn't gone over the part where when i page flip, i just start drawing a 2nd rect on the other buffer(lets call it bufferA for reference), with the 1st rect on bufferB being displayed, but then when i flip back to draw on bufferB the 1st rect is still there when i flip bacl(am i making sense, it's not a complex idea but i don't know if i'm explainign it right). i though about clearing the hole screen but is there that right route to take, and is there a more efficent way of doing it so i don't redraw every pixle and then draw the rect over that? (note this is all still at concept so i don't have any code beyond the stuff from the book demos

Share this post


Link to post
Share on other sites
Yes, you want to clear the whole screen. With Pong, there are some (possibly) more efficient methods, but the cost of clearing the screen is so insignificant these days that it really doesn't matter. Consider that in 3D games, which are of course much more performance intensive, there is simply no way to avoid redrawing each and every pixel (usually several times) each frame anyway.

Share this post


Link to post
Share on other sites
you need to fill the DDBLTFX paramater fillcolor to whatever color you want then Clear the BackBuffer with it

Example
DDBLTFX fx;
fx.dwColorfill=0
BackBuffer->Blt(NULL,NULL,NULL,DDBLT_WAIT|DDBLT_COLORFILL,&fx);
Frontbuffer->Flip(NULL,NULL);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this