2020-10-06 20:35:25 +00:00
|
|
|
|
2020-10-06 23:00:43 +00:00
|
|
|
class ExhumedMenuDelegate : RazeMenuDelegate
|
2020-10-06 20:35:25 +00:00
|
|
|
{
|
|
|
|
override int DrawCaption(String title, Font fnt, int y, bool drawit)
|
|
|
|
{
|
|
|
|
let font = generic_ui? NewConsoleFont : BigFont; // this ignores the passed font intentionally.
|
|
|
|
let texid = TexMan.CheckForTexture("MENUBLANK");
|
|
|
|
let texsize = TexMan.GetScaledSize(texid);
|
|
|
|
let fonth = font.GetGlyphHeight("A");
|
|
|
|
if (drawit)
|
|
|
|
{
|
|
|
|
int width = font.StringWidth(title);
|
|
|
|
if (texid.isValid())
|
|
|
|
{
|
|
|
|
double scalex = 1.; // Expand the box if the text is longer
|
|
|
|
if (texsize.X - 18 < width) scalex = width / (texsize.X - 18);
|
|
|
|
screen.DrawTexture(texid, false, 160, 20, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_CenterOffset, true, DTA_ScaleX, scalex);
|
|
|
|
}
|
|
|
|
screen.DrawText(font, Font.CR_UNTRANSLATED, 160 - width / 2, 20 - fonth / 2, title, DTA_FullscreenScale, FSMode_Fit320x200Top);
|
|
|
|
}
|
|
|
|
double fx, fy, fw, fh;
|
|
|
|
[fx, fy, fw, fh] = Screen.GetFullscreenRect(320, 200, FSMode_ScaleToFit43Top);
|
|
|
|
int h = texid.isValid()? texsize.Y : fonth;
|
|
|
|
return int((y+h) * fh / 200); // This must be the covered height of the header in true pixels.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|