Dx FLip() question

Started by
3 comments, last by Reilz 19 years, 8 months ago
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
Advertisement
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.
is there a DX function or should i just use a for loop?
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);
Quote:Original post by BornToCode
DDBLTFX fx;
fx.dwColorfill=0


no to sound rude but i think you mean fx.dwFillColor. dwColorfill give me an error.

This topic is closed to new replies.

Advertisement