本文整理汇总了C++中LPDIRECTDRAWSURFACE7::SetSurfaceDesc方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTDRAWSURFACE7::SetSurfaceDesc方法的具体用法?C++ LPDIRECTDRAWSURFACE7::SetSurfaceDesc怎么用?C++ LPDIRECTDRAWSURFACE7::SetSurfaceDesc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECTDRAWSURFACE7
的用法示例。
在下文中一共展示了LPDIRECTDRAWSURFACE7::SetSurfaceDesc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vdraw_ddraw_init
//.........这里部分代码省略.........
ddsd.ddpfPixelFormat.dwBBitMask = 0x0000FF;
break;
}
// Create the back surface.
rval = lpDD->CreateSurface(&ddsd, &lpDDS_Back, NULL);
if (FAILED(rval))
{
// Failed to create the back surface.
// If we attempted to create it in video memory, try system memory instead.
if (ddsd.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)
{
LOG_MSG(video, LOG_MSG_LEVEL_ERROR,
"lpDD->CreateSurface(&lpDDS_Back, DDSCAPS_VIDEOMEMORY) failed: 0x%08X", rval);
LOG_MSG(video, LOG_MSG_LEVEL_ERROR,
"Attempting to use DDSCAPS_SYSTEMMEMORY instead.");
ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
rval = lpDD->CreateSurface(&ddsd, &lpDDS_Back, NULL);
if (FAILED(rval))
{
// Failed to create the back surface in system memory.
vdraw_ddraw_free_all(false);
LOG_MSG(video, LOG_MSG_LEVEL_ERROR,
"lpDD->CreateSurface(&lpDDS_Back, DDSCAPS_SYSTEMMEMORY) failed: 0x%08X", rval);
return -10;
}
}
else
{
vdraw_ddraw_free_all(false);
LOG_MSG(video, LOG_MSG_LEVEL_ERROR,
"lpDD->CreateSurface(&lpDDS_Back, DDSCAPS_SYSTEMMEMORY) failed: 0x%08X", rval);
return -11;
}
}
// TODO: Check if this is right.
// I think this might be causing the frame counter flicker in full screen mode.
//if (!vdraw_get_fullscreen() || (rendMode >= 1 && (/*FS_No_Res_Change ||*/ Res_X != 640 || Res_Y != 480)))
if (!vdraw_get_fullscreen() || !vdraw_ddraw_is_hw_render())
lpDDS_Blit = lpDDS_Back;
if (vdraw_ddraw_is_hw_render())
{
// Normal rendering mode uses MD_Screen directly.
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
// TODO: This causes issues if the selected color depth isn't the
// same as the desktop color depth. This only affects windowed mode,
// since in fullscreen, the desktop color depth is changed.
rval = lpDDS_Back->GetSurfaceDesc(&ddsd);
if (FAILED(rval))
{
vdraw_ddraw_free_all(false);
LOG_MSG(video, LOG_MSG_LEVEL_ERROR,
"lpDDS_Back->GetSurfaceDesc() failed: 0x%08X", rval);
return -12;
}
ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH | DDSD_LPSURFACE | DDSD_PIXELFORMAT;
ddsd.dwWidth = 336;
ddsd.dwHeight = 240;
if (ddsd.ddpfPixelFormat.dwRGBBitCount > 16)
{
// 32-bit color.
ddsd.lpSurface = MD_Screen.u32;
ddsd.lPitch = 336 * 4;
}
else
{
// 15-bit or 16-bit color.
ddsd.lpSurface = MD_Screen.u16;
ddsd.lPitch = 336 * 2;
}
rval = lpDDS_Back->SetSurfaceDesc(&ddsd, 0);
if (FAILED(rval))
{
vdraw_ddraw_free_all(false);
LOG_MSG(video, LOG_MSG_LEVEL_ERROR,
"lpDDS_Back->SetSurfaceDesc() failed: 0x%08X", rval);
return -13;
}
}
// Initialize the destination rectangle.
vdraw_ddraw_adjust_RectDest();
// Reset the render mode.
vdraw_reset_renderer(false);
// Synchronize menus.
Sync_Gens_Window();
// vdraw_ddraw initialized.
return 0;
}