Jump to content
  • Advertisement


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

True Edge

Blt color fill

This topic is 5565 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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;
	dest_rect.top = 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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!