本文整理汇总了C++中LPDIRECTDRAWSURFACE7::GetCaps方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTDRAWSURFACE7::GetCaps方法的具体用法?C++ LPDIRECTDRAWSURFACE7::GetCaps怎么用?C++ LPDIRECTDRAWSURFACE7::GetCaps使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECTDRAWSURFACE7
的用法示例。
在下文中一共展示了LPDIRECTDRAWSURFACE7::GetCaps方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFrontSurface
// set frontSurface to lpDDSurface if lpDDSurface is primary
// returns true if frontSurface is set
// returns false if frontSurface is NULL and lpDDSurface is not primary
bool getFrontSurface(LPDIRECTDRAWSURFACE7 lpDDSurface)
{
//logOutput << CurrentTimeString() << "called getFrontSurface" << endl;
if (!lpDDSurface)
{
//logOutput << CurrentTimeString() << "lpDDSurface null" << endl;
return false;
}
if (!g_ddInterface)
{
LPDIRECTDRAWSURFACE7 dummy;
if (lpDDSurface->QueryInterface(IID_IDirectDrawSurface7, (LPVOID*)&dummy) == S_OK)
{
IUnknown* Unknown;
HRESULT err;
if (FAILED(err = dummy->GetDDInterface((LPVOID*)&Unknown)))
{
logOutput << CurrentTimeString() << "getFrontSurface: could not get DirectDraw interface" << endl;
printDDrawError(err, "getFrontSurface");
}
else
{
if (Unknown->QueryInterface(IID_IDirectDraw7, (LPVOID*)&g_ddInterface) == S_OK)
{
logOutput << CurrentTimeString() << "Got DirectDraw interface pointer" << endl;
}
else
{
logOutput << CurrentTimeString() << "Query of DirectDraw interface failed" << endl;
}
}
ddrawSurfaceRelease.Unhook();
dummy->Release();
ddrawSurfaceRelease.Rehook();
}
}
if (!bTargetAcquired)
{
DDSCAPS2 caps;
if (SUCCEEDED(lpDDSurface->GetCaps(&caps)))
{
//logOutput << CurrentTimeString() << "checking if surface is primary" << endl;
if (caps.dwCaps & DDSCAPS_PRIMARYSURFACE)
{
logOutput << CurrentTimeString() << "found primary surface" << endl;
g_frontSurface = lpDDSurface;
if (!SetupDDraw())
{
return false;
}
else
{
bTargetAcquired = true;
}
}
}
else
{
logOutput << CurrentTimeString() << "could not retrieve caps" << endl;
}
}
return lpDDSurface == g_frontSurface;
}