Jump to content
  • Advertisement

Archived

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

Destroyer

Need help with clipping - please help!

This topic is 6208 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

Hi, Alright - I got all my drawing functions working with animation and a little keyboard input - but the time has come, and I''ve been putting it off for too long - for clipping! Now I tried to attach a clipper to the primary surface so if the player, missle, bullet, or whatever hits the edge of the screen ,it gets clipped - no sweat, no problem. Here''s the code I did it with...
  

HRESULT DDraw_Attach_Clipper(LPDIRECTDRAWSURFACE7 lpddsurface, RECT clip)
{
	
	RGNDATA rgndata;
	rgndata.rdh.dwSize = sizeof(rgndata.rdh);
	rgndata.rdh.iType = RDH_RECTANGLES;
	rgndata.rdh.nCount = 1;
	rgndata.rdh.nRgnSize = sizeof(clip);
	rgndata.rdh.rcBound = clip;

	if(g_lpdd->CreateClipper(0,&g_lpddclipper,NULL)!=DD_OK)
	{
		D_Post_Error("Could not create clipper!");
		return g_ddrval;
	}

	if(g_lpddclipper->SetClipList(&rgndata,0)!=DD_OK)
	{
		D_Post_Error("Error Creating the Clip List!");
		return g_ddrval;
	}

	if(lpddsurface->SetClipper(g_lpddclipper)!=DD_OK)
	{
		D_Post_Error("Could not Set the clipper to the desired Surface!");
		return g_ddrval;
	}
return DD_OK;
}

  
Okay. Now I''m not an expert on clipping - in fact all the resources I''ve read on clipping are extremely vague. If you think I''m completely off - which I probably am - any refrence to a web page, documnetation, which I could read on how to program dumb ol'' clipping. Thanks, Destroyer

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!