本文整理汇总了C++中LPDIRECTDRAWSURFACE7::GetPalette方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTDRAWSURFACE7::GetPalette方法的具体用法?C++ LPDIRECTDRAWSURFACE7::GetPalette怎么用?C++ LPDIRECTDRAWSURFACE7::GetPalette使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECTDRAWSURFACE7
的用法示例。
在下文中一共展示了LPDIRECTDRAWSURFACE7::GetPalette方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupDDraw
bool SetupDDraw()
{
logOutput << CurrentTimeString() << "called SetupDDraw()" << endl;
if (!g_ddInterface)
{
logOutput << CurrentTimeString() << "SetupDDraw: DirectDraw interface not set, returning" << endl;
return false;
}
bool bSuccess = true;
bKillThread = false;
if (hCopyThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CopyDDrawTextureThread, NULL, 0, NULL))
{
if (!(hCopyEvent = CreateEvent(NULL, FALSE, FALSE, NULL)))
{
logOutput << CurrentTimeString() << "SetupDDraw: CreateEvent failed, GetLastError = " << GetLastError() << endl;
bSuccess = false;
}
}
else
{
logOutput << CurrentTimeString() << "SetupDDraw: CreateThread failed, GetLastError = " << GetLastError() << endl;
bSuccess = false;
}
if (bSuccess)
{
if (!ddUnlockFctMutex)
{
ddUnlockFctMutex = CreateMutex(NULL, FALSE, mutexName);
if (!ddUnlockFctMutex)
{
RUNEVERYRESET logOutput << CurrentTimeString() << "SetupDDraw: CreateMutex failed, GetLastError = " << GetLastError() << endl;
bSuccess = false;
}
}
}
if (bSuccess && !g_frontSurface)
{
RUNEVERYRESET logOutput << "SetupDDraw: frontSurface and surface descriptor not set, returning" << endl;
CleanUpDDraw();
return false;
}
else if (bSuccess)
{
LPDIRECTDRAWPALETTE palette = NULL;
HRESULT err;
if (SUCCEEDED(err = g_frontSurface->GetPalette(&palette)))
{
if (palette)
SetupPalette(palette);
}
else if (err == DDERR_NOPALETTEATTACHED)
{
//logOutput << CurrentTimeString() << "No palette attached to primary surface" << endl;
}
else
{
logOutput << CurrentTimeString() << "Error retrieving palette" << endl;
printDDrawError(err, "getFrontSurface");
}
}
if (bSuccess && !g_surfaceDesc)
{
logOutput << CurrentTimeString() << "SetupDDraw: no surface descriptor found, creating a new one (not an error)" << endl;
g_surfaceDesc = new DDSURFACEDESC2;
g_surfaceDesc->dwSize = sizeof(DDSURFACEDESC);
HRESULT hr;
if (FAILED(hr = ((LPDIRECTDRAWSURFACE)g_frontSurface)->GetSurfaceDesc((LPDDSURFACEDESC)g_surfaceDesc)))
{
g_surfaceDesc->dwSize = sizeof(DDSURFACEDESC2);
if (FAILED(g_frontSurface->GetSurfaceDesc(g_surfaceDesc)))
{
logOutput << CurrentTimeString() << "SetupDDraw: error getting surface descriptor" << endl;
printDDrawError(hr, "SetupDDraw");
bSuccess = false;
}
}
}
if (bSuccess && g_surfaceDesc)
{
const DDPIXELFORMAT& pf = g_surfaceDesc->ddpfPixelFormat;
if (pf.dwFlags & DDPF_RGB)
{
if (pf.dwRGBBitCount == 16)
{
logOutput << CurrentTimeString() << "SetupDDraw: found 16bit format (using R5G6B5 conversion)" << endl;
g_bConvert16to32 = true;
}
else if (pf.dwRGBBitCount == 32)
{
logOutput << CurrentTimeString() << "SetupDDraw: found 32bit format (using plain copy)" << endl;
//.........这里部分代码省略.........