## Recommended Posts

jimiwa    122
I'm making a game and so far the animation works fine but I haven't gotten the clipping right yet. When I add the clipping code, the program freezes. Can someone PLEASE help me? I would especially appreciate it if someone would give me the exact code I need to accomplish this. Thanks. I've done internet searches but still can't find any help.

LPDIRECTDRAW7 lpDD;
LPDIRECTDRAWSURFACE7 lpDDSBack;
LPDIRECTDRAWCLIPPER lpDDClipper;

RECT cliprect = {0,0,640,480};
LPRGNDATA rd = (LPRGNDATA)malloc(sizeof(RGNDATAHEADER)
+ sizeof(RECT));

ddrval = lpDD->CreateClipper( 0, lpDDClipper, NULL);
memcpy(rd->Buffer, &cliprect, sizeof(RECT));
rd->rdh.iType = RDH_RECTANGLES;
rd->rdh.nCount = 1;
rd->rdh.nRgnSize = sizeof(RECT);
rd->rdh.rcBound.left = 0;
rd->rdh.rcBound.right = 640;
rd->rdh.rcBound.top = 0;
rd->rdh.rcBound.bottom = 480;
ddrval = lpDDClipper->SetClipList(rd,0);
lpDDSBack->SetClipper(lpDDClipper);
free(rd);



##### Share on other sites
This topic is now closed to further replies.

• 9
• 11
• 9
• 11
• 9