本文整理汇总了C++中LPDIRECTDRAW7::WaitForVerticalBlank方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTDRAW7::WaitForVerticalBlank方法的具体用法?C++ LPDIRECTDRAW7::WaitForVerticalBlank怎么用?C++ LPDIRECTDRAW7::WaitForVerticalBlank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECTDRAW7
的用法示例。
在下文中一共展示了LPDIRECTDRAW7::WaitForVerticalBlank方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vdraw_ddraw_flip
/**
* vdraw_ddraw_flip(): Flip the screen buffer. [Called by vdraw_flip().]
* @return 0 on success; non-zero on error.
*/
int vdraw_ddraw_flip(void)
{
if (!lpDD)
return -1;
HRESULT rval = DD_OK;
DDSURFACEDESC2 ddsd;
ddsd.dwSize = sizeof(ddsd);
RECT RectSrc;
// Calculate the source rectangle.
vdraw_ddraw_calc_RectSrc(RectSrc);
if (vdraw_get_fullscreen())
{
// Fullscreen.
if (vdraw_ddraw_is_hw_render())
{
// Hardware rendering.
// 1x rendering.
// TODO: Test this with border color stuff.
// Wine doesn't seem to have a 320x240 fullscreen mode available...
// TODO: Test this on a system that supports 1x in fullscreen on DirectDraw.
vdraw_ddraw_draw_text(&ddsd, lpDDS_Back, true);
if (Video.VSync_FS)
{
lpDDS_Flip->Blt(&RectDest, lpDDS_Back, &RectSrc, DDBLT_WAIT | DDBLT_ASYNC, NULL);
lpDDS_Primary->Flip(NULL, DDFLIP_WAIT);
}
else
{
lpDDS_Primary->Blt(&RectDest, lpDDS_Back, &RectSrc, DDBLT_WAIT | DDBLT_ASYNC, NULL);
//lpDDS_Primary->Blt(&RectDest, lpDDS_Back, &RectSrc, NULL, NULL);
}
}
else
{
// Software rendering.
LPDIRECTDRAWSURFACE7 curBlit = lpDDS_Blit;
rval = curBlit->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
if (FAILED(rval))
goto cleanup_flip;
vdraw_rInfo.destScreen = (void*)ddsd.lpSurface;
vdraw_rInfo.width = 320;
vdraw_rInfo.height = 240;
vdraw_rInfo.destPitch = ddsd.lPitch;
if (vdraw_needs_conversion)
{
// Color depth conversion is required.
vdraw_rgb_convert(&vdraw_rInfo);
}
else
{
// Color conversion is not required.
vdraw_blitFS(&vdraw_rInfo);
}
// Draw the text.
vdraw_ddraw_draw_text(&ddsd, curBlit, false);
curBlit->Unlock(NULL);
if (curBlit == lpDDS_Back) // note: this can happen in windowed fullscreen, or if CORRECT_256_ASPECT_RATIO is defined and the current display mode is 256 pixels across
{
if (Video.VSync_FS)
{
int vb;
lpDD->GetVerticalBlankStatus(&vb);
if (!vb)
lpDD->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, 0);
}
lpDDS_Primary->Blt(&RectDest, lpDDS_Back, &RectSrc, DDBLT_WAIT | DDBLT_ASYNC, NULL);
}
else
{
if (Video.VSync_FS)
{
lpDDS_Primary->Flip(NULL, DDFLIP_WAIT);
}
}
}
}
else
{
// Windowed mode.
if (!vdraw_ddraw_is_hw_render())
{
rval = lpDDS_Blit->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
if (FAILED(rval))
//.........这里部分代码省略.........