PLEASE give me clipping code!!

Started by
18 comments, last by jimiwa 19 years, 5 months ago
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.
Advertisement
You might get more responses if you outline exactly what you need to clip.
No bombs, No guns, just an army of game creators...
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.
Do you maybe mean collision detection?
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 correctlylpDDSPrimary->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.
So, what didn't work about those two methods? Did they crash? Did the simply not do anything? Did you get strange results?
There is an article right here on GemDev.net that shows how to set this up. Apparently, you didn't "search everywhere."
idclip
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.
Without order nothing can exist - without chaos nothing can evolve.
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 ?

This topic is closed to new replies.

Advertisement