Jump to content
  • Advertisement
Sign in to follow this  
jimiwa

PLEASE give me clipping code!!

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

I cannot figure clipping out, I've searched everywhere on the internet and when I try to piece it together, it doesn't work. If you know how to do clipping with direct draw 7 (my direct draw object is lpdirectdraw7, NOT lpdirectdraw) please give me the code for clipping. I already have all the animation working, it's just the clipping code that I need.

Share this post


Link to post
Share on other sites
Advertisement
This is also your 5th post with the same question. Perhaps, as davidx9 suggested, you could be more specific in your question. Outline what you are trying to accomplish, what you have tried, exactly how what you tried failed, show the code your are having problems with, etc.

Share this post


Link to post
Share on other sites
I want to clip partly off screen sprites on my
640*480 back/front surfaces.

Basically, I have my front and back surfaces set up,
my direct draw objects, etc..

here's what I tried first:


LPRGNDATA rd;
RECT cliprect = {0,0,639,479};
ddrval = lpdd7->CreateClipper(0, &clipper, NULL);
rd = (LPRGNDATA) malloc (sizeof(RGNDATAHEADER) + sizeof(RECT));
memcpy(rd->Buffer, &cliprect, sizeof(RECT));

rd->rdh.dwSize = sizeof(RGNDATAHEADER);
rd->rdh.iType = RDH_RECTANGLES;
rd->rdh.nCount = 1;
rd->rdh.nRgnSize = sizeof(RECT);
rd->rdh.rcBound.left = 0;
rd->rdh.rcBound.right = 639;
rd->rdh.rcBound.top = 0;
rd->rdh.rcBound.bottom = 479;

ddrval = clipper->etClipList(rd,0);
if (ddrval != DD_OK)
{
exit(1);
}
ddrval = lpDDSBack->SetClipper(clipper);
if (ddrval != DD_OK)
{
exit(2);
}




I also tried this:


ddrval = lpdd7->CreateClipper(0, &clipper, NULL);
if (ddrval != DD_OK)

{
exit(1);
}
clipper->SetHWnd(0, hWnd);
// yes I do have a global hWnd window handle that is
// instantiated correctly
lpDDSPrimary->SetClipper(clipper);
clipper->Release();



two different code sources I found on the internet,
I don't know which method is closer to what I need
to do. I'm really lost, basically.

Share this post


Link to post
Share on other sites
Quote:
Original post by furthermore
Do you maybe mean collision detection?


Heh, he actually might want to induce clipping somehow. Maybe his collision detection system works too well and he'd the game to have a few bugs worthy of a patch/expansion. Silliness.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dave Hunt
There is an article right here on GemDev.net that shows how to set this up. Apparently, you didn't "search everywhere."


are the priniples used in that outdated tut with DirectDraw the same as what you would use with D3D ?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!