|
我最近正在学习DirectDraw编程,在学习中我试用了DirectX8sdk中封装的CDisplay类。在做画面剪裁时使用了CDisplay::InitClipper()函数,却没有产生剪裁效果不知道是什么原因,请大家帮忙解答。
CDisplay::InitClipper()函数如下:
HRESULT CDisplay::InitClipper()
{
LPDIRECTDRAWCLIPPER pClipper;
HRESULT hr;
// Create a clipper when using GDI to draw on the primary surface
if( FAILED( hr = m_pDD->CreateClipper( 0, &pClipper, NULL ) ) )
return hr;
pClipper->SetHWnd( 0, m_hWnd );
if( FAILED( hr = m_pddsFrontBuffer->SetClipper( pClipper ) ) )
return hr;
SAFE_RELEASE( pClipper );
return S_OK;
}
我的用法如下:
//创建全屏显示的场景
if( FAILED( hr=m_pDisplay->CreateFullScreenDisplay( hWnd, SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP ) ) )
return hr;
//初始化剪切
if (FAILED(hr=m_pDisplay->InitClipper()))
return hr;
|
|