Jump to content
  • Advertisement

Archived

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

mattd

clippers are driving me nuts!

This topic is 6236 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

some questions for directX7 clippers (LPDIRECTDRAWCLIPPER) before I go insane, which is not preferable... 1) Do i attach a clipper to the primary or back surface? 2) what code do i use to create a clipper?
  
HRESULT CVideo::CreateWindowedClipper(CSurface *dest)
{
    HRESULT result;

    LPDIRECTDRAWCLIPPER pClip;

    if(FAILED(result = m_pDD->CreateClipper(0, &pClip, NULL)))
        return result;

    if(FAILED(result = pClip->SetHWnd(0, m_hWnd)))
    {
        pClip->Release();
		return result;
    }

    if(FAILED(result = dest->SetClipper(pClip)))
    {
        pClip->Release();
        return result;
    }

    if(FAILED(result = pClip->Release()))
        return result;

    return S_OK;
}
/* --------------------- or this ... ----------------------- */
HRESULT CVideo::CreateClipper(CSurface *dest, LPRECT pBound)
{
    HRESULT result;

    LPDIRECTDRAWCLIPPER pClip;

    if(FAILED(result = m_pDD->CreateClipper(0, &pClip, NULL)))
        return result;

	LPRGNDATA lpClipList = (LPRGNDATA)malloc(sizeof(RGNDATAHEADER) +
										     sizeof(RECT));
	memcpy(lpClipList->Buffer, pBound, sizeof(RECT));
	lpClipList->rdh.dwSize = sizeof(RGNDATAHEADER);
	lpClipList->rdh.iType = RDH_RECTANGLES;
	lpClipList->rdh.nCount = 1;
	lpClipList->rdh.nRgnSize = sizeof(RECT);
	lpClipList->rdh.rcBound = *pBound;

	if(FAILED(result = pClip->SetClipList(lpClipList, 0)))
	{	
		free(lpClipList);
        pClip->Release();
		return result;
	}

    free(lpClipList);
    pClip->Release();

    return S_OK;
}
  
i see different code in different examples - and both don''t seem to work... thanks for helping, -- mattd

Share this post


Link to post
Share on other sites
Advertisement
oh, and by the way, i want to be able to do clipping in both windowed and fullscreen modes.

thanks again,
--mattd

Share this post


Link to post
Share on other sites
DirectDrawCLipper only works for windowed mode. for full screen you need to write you own clipping routine. This is done buy RECT manipulation. you will figure out how to do alot of tutorials out there for it.

I AM ALPHA & OMEGA

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!