gman
New Member
Posts: 10
|
Post by gman on Aug 6, 2004 19:34:33 GMT
I'm having a bit of a problem blitting a plain box in 256 color mode to the backbuffer. Here is my code: DDBLTFX ddbltfx; // this contains the DDBLTFX structure RECT fill_area; // this contains the destination rectangle UCHAR col = 50;
// clear out the structure and set the size field memset(&ddbltfx,0,sizeof(DDBLTFX)); ddbltfx.dwSize = sizeof(DDBLTFX);
// set the dwfillcolor field to the desired color ddbltfx.dwFillColor = col;
// fill in the destination rectangle data (your data) fill_area.top = rand()%SCREEN_HEIGHT; fill_area.left = rand()%SCREEN_WIDTH; fill_area.bottom = rand()%SCREEN_HEIGHT; fill_area.right = rand()%SCREEN_WIDTH;
// ready to blt to surface, in this case blt to backbuffer lpddsback->Blt(&fill_area, // ptr to dest rectangle NULL, // ptr to source surface, NA NULL, // ptr to source rectangle, NA DDBLT_COLORFILL | DDBLT_WAIT, // fill and wait &ddbltfx); // ptr to DDBLTFX structure
Its supposed to display a random sized box, delete it, then draw it again. Repeat that until it quits. For some reason I draw to the backbuffer and then do a page flip yet nothing shows up. I don't want to have to use images though. Such a waste of space to make a box when I can just use the blitter.
|
|
|
Post by Nocando on Aug 7, 2004 6:19:37 GMT
Hey look, that code looks like a bunch of random numbers and letters to me, wow ;D
-Asitro-
|
|
gman
New Member
Posts: 10
|
Post by gman on Aug 7, 2004 16:41:51 GMT
Ah whatever... I was going to make the classic pong. But I'll use graphics instead. I think I found out how to fix the code too. I probably just had to add a pointer to the back buffer in the Blt command. Like this: lpddsback->Blt(&fill_area, // ptr to dest rectangle &Back_Buffer, // ptr to source surface,NA NULL, // ptr to source rectangle, NA DDBLT_COLORFILL | DDBLT_WAIT, // fill and wait &ddbltfx); // ptr to DDBLTFX structure
I'm not even going to bother trying. I just made a new animation engine and need to test it
|
|