Fullscreen mode clipper

Started by
7 comments, last by BeanDog 23 years, 11 months ago
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?
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.

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.

BeanDog: Have you considered modifying your RECT''s when the sprites are only partially in the screen, instead of using a clipper?

Martin
That was me.

Martin
______________Martin EstevaolpSoftware
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?
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 );
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.
Er, BltFast?
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();

This topic is closed to new replies.

Advertisement