mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-04-23 08:09:40 +00:00
- Add some missing functions to menus.
This commit is contained in:
parent
698886e5db
commit
2ca095543f
2 changed files with 23 additions and 4 deletions
|
@ -300,6 +300,13 @@ class Menu : Object native ui version("2.4")
|
|||
screen.DrawText (ConFont, color, x, y, str, DTA_CellX, 8 * CleanXfac_1, DTA_CellY, 8 * CleanYfac_1);
|
||||
}
|
||||
|
||||
static int OptionColor(int color)
|
||||
{
|
||||
if (color != Font.CR_UNTRANSLATED) return color;
|
||||
// This needs fixing for mods with custom fonts.
|
||||
return gameinfo.gametype == GAME_Doom ? Font.CR_RED : gameinfo.gametype == GAME_Chex ? Font.CR_GREEN : gameinfo.gametype == GAME_Strife ? Font.CR_GOLD : Font.CR_GRAY;
|
||||
}
|
||||
|
||||
static Font OptionFont()
|
||||
{
|
||||
return SmallFont;
|
||||
|
|
|
@ -44,20 +44,32 @@ class OptionMenuItem : MenuItemBase
|
|||
mCentered = center;
|
||||
}
|
||||
|
||||
protected void drawText(int x, int y, int color, String text, bool grayed = false)
|
||||
{
|
||||
String label = Stringtable.Localize(mLabel);
|
||||
|
||||
int overlay = grayed? Color(96,48,0,0) : 0;
|
||||
|
||||
screen.DrawText (SmallFont, Menu.OptionColor(color), x, y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay);
|
||||
}
|
||||
|
||||
protected int drawLabel(int indent, int y, int color, bool grayed = false)
|
||||
{
|
||||
String label = Stringtable.Localize(mLabel);
|
||||
|
||||
int overlay = grayed? Color(96,48,0,0) : 0;
|
||||
|
||||
int x;
|
||||
int w = SmallFont.StringWidth(label) * CleanXfac_1;
|
||||
if (!mCentered) x = indent - w;
|
||||
else x = (screen.GetWidth() - w) / 2;
|
||||
screen.DrawText (SmallFont, color, x, y, label, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay);
|
||||
DrawText(x, y, color, label, grayed);
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
protected void drawValue(int indent, int y, int color, String text, bool grayed = false)
|
||||
{
|
||||
DrawText(indent + CursorSpace(), y, color, text, grayed);
|
||||
}
|
||||
|
||||
int CursorSpace()
|
||||
{
|
||||
return (14 * CleanXfac_1);
|
||||
|
|
Loading…
Reference in a new issue