Jump to content
  • Advertisement

Archived

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

BeanDog

Fullscreen mode clipper

This topic is 6914 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 a problem. Some of my larger sprites will not show only part if they are only, say, halfway on the screen. The entire sprite is clipped. I figured this was because I had no clipper defined. So I changed all my BltFast''s to Blt''s and made a clipper, setting it to my main hwnd. WHY DIDN''T THAT HELP ANYTHING?

Share this post


Link to post
Share on other sites
Advertisement
Since full screen - YES FULL SCREEN uses THE ENTIRE screen, clippers dont do anything. A clipper is designed to prevent a windowed app from drawing outside of its rectangle.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
BeanDog: Have you considered modifying your RECT''s when the sprites are only partially in the screen, instead of using a clipper?

Martin

Share this post


Link to post
Share on other sites
Etnu: I believe that you are incorrect. DirectDraw clippers serve the same purpose in full screen mode as they do in a windowed mode. You have to attach a clipper to your primary surface, otherwise your sprites will not be displayed if any part of them are going to be outside the surface (off the screen).

BeanDog: Maybe you could post some code or be a little more specific as to where your problem is?

Share this post


Link to post
Share on other sites
This is the only code I have to init the clipper. I scoured the tutorials, but this is all I came up with:

pcClipper->SetHWnd( 0, hwnd );
Primary->SetClipper( pcClipper );

where Clipper is my clipper (go figure), hwnd is my main window''s HWND, and Primary is my primary surface.

OH MAN! maybe if I attached the clipper to the surface I am blt-ing to...

do I feel like an idiot or what. That works when I change Primary to Back. Sorry for bothering y''all.



~BenDilts( void );

Share this post


Link to post
Share on other sites
By the way, does anybody know how to do a BLT that will ignore the clipper? That way, I could make a clipper for my main screen, but I could not use it when I blt outside of it.

Share this post


Link to post
Share on other sites
We had this thread last week. Here is how you can set a clipper for the back buffer. Actually, this code can be used for any surface and any RECT. Use as you see fit.

This is lifted right out of my fully functional DDraw, Sound, Input, Play, and D3D library. Sorry about the poor formatting. And Tank() is just one of my error routines.


// create the clipper for back surface
RECT rcScreen;
SetRect(&rcScreen,0,0,ddWidth,ddHeight);
LPDIRECTDRAWCLIPPER pClipper;
LPRGNDATA lpRgnData;
if (FAILED(result = m_pDirectDrawObj->CreateClipper(0, &pClipper, NULL)))
return (Tank(result,"CreateClipper"));
lpRgnData = (LPRGNDATA)malloc(sizeof(RGNDATAHEADER)+sizeof(RECT));
memcpy(lpRgnData->Buffer, &rcScreen, sizeof(RECT));
lpRgnData->rdh.dwSize = sizeof(RGNDATAHEADER);
lpRgnData->rdh.iType = RDH_RECTANGLES;
lpRgnData->rdh.nCount = 1;
lpRgnData->rdh.nRgnSize = sizeof(RECT);
memcpy(&lpRgnData->rdh.rcBound, &rcScreen, sizeof(RECT));
if (FAILED(result = pClipper->SetClipList(lpRgnData,0))) {
free(lpRgnData);
pClipper->Release();
return (Tank(result, "SetClipList"));
}
free(lpRgnData);
if (FAILED(result = m_pBackBuffer->SetClipper(pClipper))) {
pClipper->Release();
return (Tank(result, "SetClipper"));
}
pClipper->Release();

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!