- allow setting the startup screen's title through GAMEINFO lump.

SVN r2850 (trunk)
This commit is contained in:
Christoph Oelckers 2010-09-24 14:27:52 +00:00
commit 3f420c97bd
7 changed files with 51 additions and 26 deletions

View file

@ -355,7 +355,7 @@ void LayoutMainWindow (HWND hWnd, HWND pane)
w = rect.right;
h = rect.bottom;
if (DoomStartupInfo != NULL && GameTitleWindow != NULL)
if (DoomStartupInfo.Name.IsNotEmpty() && GameTitleWindow != NULL)
{
bannerheight = GameTitleFontHeight + 5;
MoveWindow (GameTitleWindow, 0, 0, w, bannerheight, TRUE);
@ -399,6 +399,19 @@ void LayoutMainWindow (HWND hWnd, HWND pane)
}
}
//==========================================================================
//
// I_SetIWADInfo
//
//==========================================================================
void I_SetIWADInfo(const IWADInfo *info)
{
// Make the startup banner show itself
LayoutMainWindow(Window, NULL);
}
//==========================================================================
//
// LConProc
@ -501,7 +514,7 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_DRAWITEM:
// Draw title banner.
if (wParam == IDC_STATIC_TITLE && DoomStartupInfo != NULL)
if (wParam == IDC_STATIC_TITLE && DoomStartupInfo.Name.IsNotEmpty())
{
const PalEntry *c;
@ -511,7 +524,7 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
// Draw the background.
rect = drawitem->rcItem;
rect.bottom -= 1;
c = (const PalEntry *)&DoomStartupInfo->BkColor;
c = (const PalEntry *)&DoomStartupInfo.BkColor;
hbr = CreateSolidBrush (RGB(c->r,c->g,c->b));
FillRect (drawitem->hDC, &drawitem->rcItem, hbr);
DeleteObject (hbr);
@ -519,14 +532,14 @@ LRESULT CALLBACK LConProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
// Calculate width of the title string.
SetTextAlign (drawitem->hDC, TA_TOP);
oldfont = SelectObject (drawitem->hDC, GameTitleFont != NULL ? GameTitleFont : (HFONT)GetStockObject (DEFAULT_GUI_FONT));
titlelen = (int)strlen (DoomStartupInfo->Name);
GetTextExtentPoint32 (drawitem->hDC, DoomStartupInfo->Name, titlelen, &size);
titlelen = (int)DoomStartupInfo.Name.Len();
GetTextExtentPoint32 (drawitem->hDC, DoomStartupInfo.Name, titlelen, &size);
// Draw the title.
c = (const PalEntry *)&DoomStartupInfo->FgColor;
c = (const PalEntry *)&DoomStartupInfo.FgColor;
SetTextColor (drawitem->hDC, RGB(c->r,c->g,c->b));
SetBkMode (drawitem->hDC, TRANSPARENT);
TextOut (drawitem->hDC, rect.left + (rect.right - rect.left - size.cx) / 2, 2, DoomStartupInfo->Name, titlelen);
TextOut (drawitem->hDC, rect.left + (rect.right - rect.left - size.cx) / 2, 2, DoomStartupInfo.Name, titlelen);
SelectObject (drawitem->hDC, oldfont);
return TRUE;
}