This topic is now archived and is closed to further replies.

True Edge

Blt color fill

Recommended Posts

DDBLTFX ddbltfx;
	RECT dest_rect;


	ddbltfx.dwSize = sizeof(ddbltfx);
	ddbltfx.dwFillColor = RGB16(rand()%256,rand()%256,rand()%256);

	unsigned short y1 = rand()%SCREEN_HEIGHT;
	unsigned short y2 = rand()%SCREEN_HEIGHT;
	unsigned short x1 = rand()%SCREEN_WIDTH;
	unsigned short x2 = rand()%SCREEN_WIDTH;

	dest_rect.bottom = y2; = y1;
	dest_rect.left = x1;
	dest_rect.right = x2;

	lpddsprimary->Blt(&dest_rect,NULL,NULL,DDBLT_COLORFILL | DDBLT_WAIT,&ddbltfx);
ok, what it''s telling me is that there are negative values for the coordinates. The program still works without crashing but when you exit it gives you the "this program now has to close" message which is annoying . I made the variables unsigned, shouldn''t that make the negatives go away?

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
it''s telling you that either bottom is less than top or right is less than left or both. you need to add two if tests to swap the values if that''s the case or re-work the setting of x2 and y2 so that they are never less than x1 and y1 respectively.

Share this post

Link to post
Share on other sites