Original Post
I have a console that I'm adding into my RPG and I can get the console to AlphaBlend itself in the WinGDI to the surface, but I can't get it to use the normal BitBlt function. Well, the BitBlt function will blit the background from the buffer, but not the text. The code is the following.
void VIDEO::DrawConsole()
{
COLORREF ColorInfo;
int BlitConsolePosition = 0;
int ConsoleMessageCount = Game->GetConsole()->GetMessageCount();
if(Game->GetConsole()->GetHasChanged())
{
if(!BitBlt(hdcConsoleBufferImage, 0, 0, MAINWINDOWWIDTH, MAINWINDOWHEIGHT, hdcConsoleBackgroundImage, 0, 0, SRCCOPY))
{
MessageBox(hMainWindow, "Failure to blit ConsoleBackgroundImage to buffer!", "Video Error.", MB_OK | MB_ICONEXCLAMATION);
PostQuitMessage(0);
}
ColorInfo = RGB(255, 255, 255);
SetTextColor(hdcConsoleBufferImage, ColorInfo);
SetBkMode(hdcConsoleBufferImage, TRANSPARENT);
for(int i = 0; i <= ConsoleMessageCount; i++)
{
TextOut(hdcConsoleBufferImage, 0, BlitConsolePosition, Game->GetConsole()->GetMessage(i), strlen(Game->GetConsole()->GetMessage(i)));
BlitConsolePosition += SPACEBETWEENLINES;
}
Game->GetConsole()->VisualUpdated();
}
if(Game->GetUseAlphaBlending())
{
BLENDFUNCTION BlendData;
BlendData.AlphaFormat = NULL;
BlendData.BlendFlags = NULL;
BlendData.BlendOp = AC_SRC_OVER;
BlendData.SourceConstantAlpha = 255;
if(!(AlphaBlend(hdcBufferImage, 0, 0, MAINWINDOWWIDTH, 100, hdcConsoleBufferImage, 0, 0, MAINWINDOWWIDTH, 100, BlendData)))
{
MessageBox(hMainWindow, "Failure to blend console to buffer!", "Video Error.", MB_OK | MB_ICONEXCLAMATION);
PostQuitMessage(0);
}
}
else
{
if(!BitBlt(hdcBufferImage, 0, 0, MAINWINDOWWIDTH, 100, hdcConsoleBackgroundImage, 0, 0, SRCCOPY))
{
MessageBox(hMainWindow, "Failure to blit ConsoleBackgroundImage!", "Video Error.", MB_OK | MB_ICONEXCLAMATION);
PostQuitMessage(0);
}
}
}
The AlphaBlend works perfectly fine, but the BitBlt function when I turn AlphaBlend off and use the BitBlt function, the text doesn't appear. Any ideas?
[edited by - Daishi on July 16, 2003 3:45:18 PM]