Clearing a surface in DDraw

Started by
1 comment, last by Omalacon 24 years, 5 months ago
If it's a D3D app, you should call clear() using the D3D device. If it's a regular DDraw app, try calling Blt(), specifying color fill and passing in black.

Advertisement
I am using double buffering (2 attached surfaces then flipping), but every time I flip I need to mannually clear the last image on the surface mannually (by writing each pixel to black). Is there a way to clear the entire screen easily with one command? (Like in the old Basic days with CLS)

-Omalacon

[This message has been edited by Omalacon (edited October 27, 1999).]

Try this:

code:
    DDBLTFX ddbltfx;    ZeroMemory(&ddbltfx, sizeof(ddbltfx));    ddbltfx.dwSize = sizeof(ddbltfx);    ddbltfx.dwFillColor = 0;    pDDS->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);

where pDDS is a DirectDraw surface. Hope this helps.

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

This topic is closed to new replies.

Advertisement