Jump to content
  • Advertisement


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


clipping in dx7

This topic is 6380 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 have problems getting the clipping object to work in directdraw this is what I have done IDirectDrawSurface7 *lpBackBuffer,*lpPrimary; IDirectDrawClipper *lpClip; RGNDATA *lpRgnData; RGNDATAHEADER *lpRgnHeader; then I set up the RGNDATAHEADER and RGNDATA structs like this lpRgnHeader->dwSize = sizeof(RGNDATAHEADER); lpRgnHeader->iType = RDH_RECTANGLES; lpRgnHeader->nCount = 1; lpRgnHeader->nRgnSize = 0; lpRgnHeader->rcBound.top = 0; lpRgnHeader->rcBound.left = 0; lpRgnHeader->rcBound.bottom = 600; lpRgnHeader->rcBound.right = 800; lpRgnData->rdh.dwSize = lpRgnHeader->dwSize; lpRgnData->rdh.iType = lpRgnHeader->iType; lpRgnData->rdh.nCount = lpRgnHeader->nCount; lpRgnData->rdh.nRgnSize = lpRgnHeader->nRgnSize; lpRgnData->rdh.rcBound = lpRgnHeader->rcBound; lpRgnData->Buffer[0] = (char)0; lpRgnData->Buffer[1] = (char)600; lpRgnData->Buffer[2] = (char)0; lpRgnData->Buffer[3] = (char)800; I''m not quite sure about the Buffer member in RGNDATA, in MSDN it says Buffer: Specifies an arbitrary-size buffer that contains the RECT structures that make up the region. but the Buffer member is of type char not RECT... anyway, after this I use the IDirectDrawClipper::SetClipList function: lpClip->SetClipList(lpRgnData,0); and then the IDirectDrawSurface7::SetClipper function: lpPrimary->SetClipper(lpClip); but when I run the program it just quits... anyone have done any clipping before and have some code to lend or something cause this is really disturbing thanks in advance

Share this post

Link to post
Share on other sites
First you need to allocate memory for RgnData, enough memory for a RgnDataHeader and the number of rects that you are useing. then to copy the rect(''s) into the RgnDate.buffer you need to do a memcopy, not just an assignment statement. I program in delphi so I dont know if the rest of your code is correct. There is an article on this very subject in C, check it out

A good game by any other name is still a good game, STOP the RPG mentality

Share this post

Link to post
Share on other sites
You say the buffer is made up of RECT types, but you don''t use them. just based on what you said, try

// (if you aren''t using C++...then change this but)
RECT *buffer = new RECT[ n ];
buffer[0]->left = 0;
buffer[0]->top = 0;
buffer[ n-1 ]->bottom = 0;
lpRgnData->Buffer = (char *)buffer;

just a guess

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!