mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-12 06:41:39 +00:00
- restructured the option menu drawer for easier replacement of the caption handler.
This commit is contained in:
parent
cc9cadfac1
commit
35ff0a42a6
1 changed files with 37 additions and 23 deletions
|
@ -239,15 +239,7 @@ class OptionMenu : Menu
|
||||||
|
|
||||||
if (y <= 0)
|
if (y <= 0)
|
||||||
{
|
{
|
||||||
let font = generic_ui || !mDesc.mFont? NewSmallFont : mDesc.mFont;
|
y = DrawCaption(mDesc.mTitle, y, false);
|
||||||
if (font && mDesc.mTitle.Length() > 0)
|
|
||||||
{
|
|
||||||
y = -y + font.GetHeight();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
y = -y;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
y *= CleanYfac_1;
|
y *= CleanYfac_1;
|
||||||
int rowheight = OptionMenuSettings.mLinespacing * CleanYfac_1;
|
int rowheight = OptionMenuSettings.mLinespacing * CleanYfac_1;
|
||||||
|
@ -430,25 +422,47 @@ class OptionMenu : Menu
|
||||||
return screen.GetWidth() / 2 + indent * CleanXfac_1;
|
return screen.GetWidth() / 2 + indent * CleanXfac_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//
|
||||||
|
// draws and/or measures the caption.
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
virtual int DrawCaption(String title, int y, bool drawit)
|
||||||
|
{
|
||||||
|
let font = generic_ui || !mDesc.mFont ? NewSmallFont : mDesc.mFont;
|
||||||
|
if (font && mDesc.mTitle.Length() > 0)
|
||||||
|
{
|
||||||
|
let font = generic_ui || !mDesc.mFont ? NewSmallFont : mDesc.mFont;
|
||||||
|
if (drawit)
|
||||||
|
{
|
||||||
|
let tt = Stringtable.Localize(title);
|
||||||
|
screen.DrawText(font, OptionMenuSettings.mTitleColor,
|
||||||
|
(screen.GetWidth() - font.StringWidth(tt) * CleanXfac_1) / 2, 10 * CleanYfac_1,
|
||||||
|
tt, DTA_CleanNoMove_1, true);
|
||||||
|
}
|
||||||
|
return y + font.GetHeight();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
override void Drawer ()
|
override void Drawer ()
|
||||||
{
|
{
|
||||||
int y = mDesc.mPosition;
|
int y = mDesc.mPosition;
|
||||||
|
|
||||||
if (y <= 0)
|
if (y <= 0)
|
||||||
{
|
{
|
||||||
let font = generic_ui || !mDesc.mFont? NewSmallFont : mDesc.mFont;
|
y = DrawCaption(mDesc.mTitle, -y, true);
|
||||||
if (font && mDesc.mTitle.Length() > 0)
|
|
||||||
{
|
|
||||||
let tt = Stringtable.Localize(mDesc.mTitle);
|
|
||||||
screen.DrawText (font, OptionMenuSettings.mTitleColor,
|
|
||||||
(screen.GetWidth() - font.StringWidth(tt) * CleanXfac_1) / 2, 10*CleanYfac_1,
|
|
||||||
tt, DTA_CleanNoMove_1, true);
|
|
||||||
y = -y + font.GetHeight();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
y = -y;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mDesc.mDrawTop = y;
|
mDesc.mDrawTop = y;
|
||||||
int fontheight = OptionMenuSettings.mLinespacing * CleanYfac_1;
|
int fontheight = OptionMenuSettings.mLinespacing * CleanYfac_1;
|
||||||
|
|
Loading…
Reference in a new issue