- use the new console font for the options menu to gain space and better character support.

So far this is just an experiment, this needs a bit of work to become viable.
This commit is contained in:
Christoph Oelckers 2019-03-17 14:40:06 +01:00
parent b59b092c49
commit 2e260c6367
7 changed files with 36 additions and 30 deletions

View File

@ -551,9 +551,13 @@ void V_UpdateModeSize (int width, int height)
else if (w >= 1600 && w < 1920) factor = 3;
else factor = w / 640;
CleanXfac = CleanYfac = CleanXfac_1 = CleanYfac_1 = factor;
CleanWidth = CleanWidth_1 = width / CleanXfac_1;
CleanHeight = CleanHeight_1 = height / CleanYfac_1;
CleanXfac = CleanYfac = factor;
CleanWidth = width / CleanXfac;
CleanHeight = height / CleanYfac;
CleanYfac_1 = CleanXfac_1 = MAX(1, int (CleanXfac * 0.7));
CleanWidth_1 = width / CleanXfac_1;
CleanHeight_1 = height / CleanYfac_1;
DisplayWidth = width;
DisplayHeight = height;

View File

@ -344,11 +344,13 @@ OptionValue AutoOffOn
OptionMenuSettings
{
// These can be overridden if a different menu fonts requires it.
Linespacing 8
Linespacing 17
/*
IfGame(Heretic, Hexen)
{
Linespacing 9
}
*/
}
DefaultOptionMenu

View File

@ -285,7 +285,7 @@ class Menu : Object native ui version("2.4")
static void DrawConText (int color, int x, int y, String str)
{
screen.DrawText (ConFont, color, x, y, str, DTA_CellX, 8 * CleanXfac_1, DTA_CellY, 8 * CleanYfac_1);
screen.DrawText (NewConsoleFont, color, x, y, str, DTA_CellX, 9 * CleanXfac_1/2, DTA_CellY, 8 * CleanYfac_1);
}
}

View File

@ -451,7 +451,7 @@ class OptionMenu : Menu
}
int ytop = y + mDesc.mScrollTop * 8 * CleanYfac_1;
int lastrow = screen.GetHeight() - SmallFont.GetHeight() * CleanYfac_1;
int lastrow = screen.GetHeight() - NewConsoleFont.GetHeight() * CleanYfac_1;
int i;
for (i = 0; i < mDesc.mItems.Size() && y <= lastrow; i++)
@ -519,8 +519,8 @@ class GameplayMenu : OptionMenu
Super.Drawer();
String s = String.Format("dmflags = %d dmflags2 = %d", dmflags, dmflags2);
screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue,
(screen.GetWidth() - SmallFont.StringWidth (s) * CleanXfac_1) / 2, 0, s,
screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue,
(screen.GetWidth() - NewConsoleFont.StringWidth (s) * CleanXfac_1) / 2, 0, s,
DTA_CleanNoMove_1, true);
}
}
@ -532,8 +532,8 @@ class CompatibilityMenu : OptionMenu
Super.Drawer();
String s = String.Format("compatflags = %d compatflags2 = %d", compatflags, compatflags2);
screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue,
(screen.GetWidth() - SmallFont.StringWidth (s) * CleanXfac_1) / 2, 0, s,
screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue,
(screen.GetWidth() - NewConsoleFont.StringWidth (s) * CleanXfac_1) / 2, 0, s,
DTA_CleanNoMove_1, true);
}
}

View File

@ -51,10 +51,10 @@ class OptionMenuItem : MenuItemBase
int overlay = grayed? Color(96,48,0,0) : 0;
int x;
int w = SmallFont.StringWidth(label) * CleanXfac_1;
int w = NewConsoleFont.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);
screen.DrawText (NewConsoleFont, color, x, y, label, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay);
return x;
}
@ -71,7 +71,7 @@ class OptionMenuItem : MenuItemBase
override int GetIndent()
{
if (mCentered) return 0;
return SmallFont.StringWidth(Stringtable.Localize(mLabel));
return NewConsoleFont.StringWidth(Stringtable.Localize(mLabel));
}
override bool MouseEvent(int type, int x, int y)
@ -140,7 +140,7 @@ class OptionMenuItemLabeledSubmenu : OptionMenuItemSubmenu
String text = mLabelCVar.GetString();
if (text.Length() == 0) text = Stringtable.Localize("$notset");
screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true);
screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true);
return indent;
}
@ -298,7 +298,7 @@ class OptionMenuItemOptionBase : OptionMenuItem
int Selection = GetSelection();
String text = StringTable.Localize(OptionValues.GetText(mValues, Selection));
if (text.Length() == 0) text = "Unknown";
screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay);
screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay);
return indent;
}
@ -506,7 +506,7 @@ class OptionMenuItemControlBase : OptionMenuItem
}
else
{
screen.DrawText(SmallFont, Font.CR_BLACK, indent + CursorSpace(), y + (OptionMenuSettings.mLinespacing-8)*CleanYfac_1, "---", DTA_CleanNoMove_1, true);
screen.DrawText(NewConsoleFont, Font.CR_BLACK, indent + CursorSpace(), y + (OptionMenuSettings.mLinespacing-8)*CleanYfac_1, "---", DTA_CleanNoMove_1, true);
}
return indent;
}
@ -644,9 +644,9 @@ class OptionMenuItemStaticTextSwitchable : OptionMenuItem
override int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected)
{
String txt = StringTable.Localize(mCurrent? mAltText : mLabel);
int w = SmallFont.StringWidth(txt) * CleanXfac_1;
int w = NewConsoleFont.StringWidth(txt) * CleanXfac_1;
int x = (screen.GetWidth() - w) / 2;
screen.DrawText (SmallFont, mColor, x, y, txt, DTA_CleanNoMove_1, true);
screen.DrawText (NewConsoleFont, mColor, x, y, txt, DTA_CleanNoMove_1, true);
return -1;
}
@ -731,7 +731,7 @@ class OptionMenuSliderBase : OptionMenuItem
if (fracdigits >= 0)
{
textbuf = String.format(formater, max);
maxlen = SmallFont.StringWidth(textbuf) * CleanXfac_1;
maxlen = NewConsoleFont.StringWidth(textbuf) * CleanXfac_1;
}
mSliderShort = right + maxlen > screen.GetWidth();
@ -752,7 +752,7 @@ class OptionMenuSliderBase : OptionMenuItem
if (fracdigits >= 0 && right + maxlen <= screen.GetWidth())
{
textbuf = String.format(formater, cur);
screen.DrawText(SmallFont, Font.CR_DARKGRAY, right, y, textbuf, DTA_CleanNoMove_1, true);
screen.DrawText(NewConsoleFont, Font.CR_DARKGRAY, right, y, textbuf, DTA_CleanNoMove_1, true);
}
}
@ -973,7 +973,7 @@ class OptionMenuFieldBase : OptionMenuItem
drawLabel(indent, y, selected ? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, grayed);
int overlay = grayed? Color(96, 48, 0, 0) : 0;
screen.DrawText(SmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, Represent(), DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay);
screen.DrawText(NewConsoleFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, Represent(), DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay);
return indent;
}
@ -1022,7 +1022,7 @@ class OptionMenuItemTextField : OptionMenuFieldBase
override String Represent()
{
if (mEnter) return mEnter.GetText() .. SmallFont.GetCursor();
if (mEnter) return mEnter.GetText() .. NewConsoleFont.GetCursor();
else return GetCVarString();
}
@ -1032,7 +1032,7 @@ class OptionMenuItemTextField : OptionMenuFieldBase
{
// reposition the text so that the cursor is visible when in entering mode.
String text = Represent();
int tlen = SmallFont.StringWidth(text) * CleanXfac_1;
int tlen = NewConsoleFont.StringWidth(text) * CleanXfac_1;
int newindent = screen.GetWidth() - tlen - CursorSpace();
if (newindent < indent) indent = newindent;
}
@ -1044,7 +1044,7 @@ class OptionMenuItemTextField : OptionMenuFieldBase
if (mkey == Menu.MKEY_Enter)
{
Menu.MenuSound("menu/choose");
mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), SmallFont, GetCVarString(), -1, fromcontroller);
mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), NewConsoleFont, GetCVarString(), -1, fromcontroller);
mEnter.ActivateMenu();
return true;
}
@ -1156,7 +1156,7 @@ class OptionMenuItemScaleSlider : OptionMenuItemSlider
if ((Selection == 0 || Selection == -1) && mClickVal <= 0)
{
String text = Selection == 0? TextZero : Selection == -1? TextNegOne : "";
screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true);
screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true);
}
else
{

View File

@ -132,7 +132,7 @@ class OptionMenuItemReverbSelect : OptionMenuItemSubMenu
int x = drawLabel(indent, y, selected? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor);
String text = ReverbEdit.GetSelectedEnvironment();
screen.DrawText (SmallFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true);
screen.DrawText (NewConsoleFont, OptionMenuSettings.mFontColorValue, indent + CursorSpace(), y, text, DTA_CleanNoMove_1, true);
return indent;
}
@ -210,7 +210,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase
virtual String Represent()
{
return mEnter.GetText() .. SmallFont.GetCursor();
return mEnter.GetText() .. NewConsoleFont.GetCursor();
}
//=============================================================================
@ -221,7 +221,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase
mDrawX = indent + CursorSpace();
if (mEnter)
{
screen.DrawText(SmallFont, OptionMenuSettings.mFontColorValue, mDrawX, y, Represent(), DTA_CleanNoMove_1, true);
screen.DrawText(NewConsoleFont, OptionMenuSettings.mFontColorValue, mDrawX, y, Represent(), DTA_CleanNoMove_1, true);
}
else
{
@ -235,7 +235,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase
if (mkey == Menu.MKEY_Enter)
{
Menu.MenuSound("menu/choose");
mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), SmallFont, String.Format("%.3f", GetSliderValue()), -1, fromcontroller);
mEnter = TextEnterMenu.OpenTextEnter(Menu.GetCurrentMenu(), NewConsoleFont, String.Format("%.3f", GetSliderValue()), -1, fromcontroller);
mEnter.ActivateMenu();
return true;
}

View File

@ -84,7 +84,7 @@ class TextEnterMenu : Menu
deprecated("3.8") static TextEnterMenu Open(Menu parent, String textbuffer, int maxlen, int sizemode, bool showgrid = false, bool allowcolors = false)
{
let me = new("TextEnterMenu");
me.Init(parent, SmallFont, textbuffer, maxlen*8, showgrid, allowcolors);
me.Init(parent, NewConsoleFont, textbuffer, maxlen*8, showgrid, allowcolors);
return me;
}