Skip to main content
GameDev.net gamedev.net
🔒 Locked

Blt() problem

Started by OoMMMoO Sep 8, 2000 at 1:55 PM 1 replies 500+ views
Original Post
OoMMMoO
OoMMMoO
Im trying to fill the back buffer with random colors and when I use the Blt function I get an error saying this program commited an illegal operation. I went to the debug screen and it pointed an arrow where my Blt function was. Can someone just write the a Blt function for me as if you where to fill the screen so I have an example to go from? like lpddsback->Blt(the error is here some where); please help
CMN
CMN
    
DDBLTFX ddbltfx;
memset(&ddblfx, 0, sizeof(DDBLTFX));
ddbltfx.dwSize=sizeof(ddbltfx); // Don''t know if this should be here, but maybe.

ddbltfx.dwFillColor=rand()%0xFFFFFF; // if you are in 32bit mode


lpddsback->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddbltfx);

// That''s it



/CMN


Redleaf
Redleaf
In the function I use to fill an entire surface with a color, this is what my call to Blt looks like:

        
lpdds->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);


The NULL params are where you'd normally have pointers to a destination rect, a source surface, and a source rectangle. The DDBLT_COLORFILL tag tells the Blt function what the ddbltfx struct at the end is used for, as far as I know. You have to zero out the memory and initialize the size member of such a struct, and then initialize its dwFillColor with the color you wish to display. I use a macro which depends on what bit depth my program is using, to determine the actual value of the fillcolor variable in this struct.

I hope this helps.

Edited by - Redleaf on September 8, 2000 3:15:17 PM

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.