64,282
社区成员
发帖
与我相关
我的任务
分享
// Load images from offscteen buffer to primary buffer and for display.
void CDDrawSystem::Display()
{
HRESULT hRet;
RECT rt;
POINT p = {0, 0};
ClientToScreen(hWnd, &p);
rt.left = 0 + p.x; rt.top = 0 + p.y; rt.right = 800 + p.x; rt.bottom = 600 + p.y;
while( 1 )
{
hRet = m_pddsFrontBuffer->Blt(&rt, m_pddsStoreBuffer, NULL, DDBLT_WAIT, NULL);
if (hRet == DD_OK)
break;
else if(hRet == DDERR_SURFACELOST)
{
m_pddsFrontBuffer->Restore();
m_pddsStoreBuffer->Restore();
}
else if(hRet != DDERR_WASSTILLDRAWING)
return;
}
}
/////////////////////////////////////////////////////////////////////////////
// CDdraw_in_mfcwindView drawing
void CDdraw_in_mfcwindView::OnDraw(CDC* pDC)
{
// CDdraw_in_mfcwindDoc* pDoc = GetDocument();
// ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
// Now you can call CDDrawSystem member functions for drawings
if(bDDrawActive) // make sure directdraw interfaces are
{
ddobj.Clear();
ddobj.TestDraw(x, y);
ddobj.Display();
}
}