- fixed font scaling in RR's confirmation screens.

This commit is contained in:
Christoph Oelckers 2020-10-10 00:51:26 +02:00
parent 2e94fdc3b5
commit 2237113a77
3 changed files with 10 additions and 5 deletions

View file

@ -67,6 +67,7 @@
#include "gstrings.h" #include "gstrings.h"
#include "menustate.h" #include "menustate.h"
#include "i_interface.h" #include "i_interface.h"
#include "vm.h"
#define LEFTMARGIN 8 #define LEFTMARGIN 8
#define RIGHTMARGIN 8 #define RIGHTMARGIN 8
@ -110,6 +111,8 @@ constate_e ConsoleState = c_up;
double NotifyFontScale = 1; double NotifyFontScale = 1;
DEFINE_GLOBAL(NotifyFontScale)
void C_SetNotifyFontScale(double scale) void C_SetNotifyFontScale(double scale)
{ {
NotifyFontScale = scale; NotifyFontScale = scale;

View file

@ -178,6 +178,7 @@ struct _ native // These are the global variables, the struct is only here to av
native readonly int GameTicRate; native readonly int GameTicRate;
native MenuDelegateBase menuDelegate; native MenuDelegateBase menuDelegate;
native readonly int consoleplayer; native readonly int consoleplayer;
native readonly double NotifyFontScale;
} }
struct MusPlayingInfo native struct MusPlayingInfo native

View file

@ -89,7 +89,7 @@ class MessageBoxMenu : Menu
int mr2 = destWidth/2 + 10 + textFont.StringWidth(Stringtable.Localize("$TXT_NO")); int mr2 = destWidth/2 + 10 + textFont.StringWidth(Stringtable.Localize("$TXT_NO"));
mMouseRight = MAX(mr1, mr2); mMouseRight = MAX(mr1, mr2);
mParentMenu = parent; mParentMenu = parent;
mMessage = textFont.BreakLines(Stringtable.Localize(message), generic_ui? 600 : 300); mMessage = textFont.BreakLines(Stringtable.Localize(message), 300/NotifyFontScale);
mMessageMode = messagemode; mMessageMode = messagemode;
if (playsound) if (playsound)
{ {
@ -107,7 +107,7 @@ class MessageBoxMenu : Menu
override void Drawer () override void Drawer ()
{ {
int i, y; int i, y;
int fontheight = textFont.GetHeight(); int fontheight = textFont.GetHeight() * NotifyFontScale;
y = destHeight / 2; y = destHeight / 2;
@ -116,7 +116,8 @@ class MessageBoxMenu : Menu
for (i = 0; i < c; i++) for (i = 0; i < c; i++)
{ {
screen.DrawText (textFont, Font.CR_UNTRANSLATED, destWidth/2 - mMessage.StringWidth(i)/2, y, mMessage.StringAt(i), DTA_VirtualWidth, destWidth, DTA_VirtualHeight, destHeight, DTA_KeepRatio, true); screen.DrawText (textFont, Font.CR_UNTRANSLATED, destWidth/2 - mMessage.StringWidth(i)*NotifyFontScale/2, y, mMessage.StringAt(i), DTA_VirtualWidth, destWidth, DTA_VirtualHeight, destHeight, DTA_KeepRatio, true,
DTA_ScaleX, NotifyFontScale, DTA_ScaleY, NotifyFontScale);
y += fontheight; y += fontheight;
} }
@ -124,8 +125,8 @@ class MessageBoxMenu : Menu
{ {
y += fontheight; y += fontheight;
mMouseY = y; mMouseY = y;
screen.DrawText(textFont, messageSelection == 0? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, destWidth / 2, y, Stringtable.Localize("$TXT_YES"), DTA_VirtualWidth, destWidth, DTA_VirtualHeight, destHeight, DTA_KeepRatio, true); screen.DrawText(textFont, messageSelection == 0? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, destWidth / 2, y, Stringtable.Localize("$TXT_YES"), DTA_VirtualWidth, destWidth, DTA_VirtualHeight, destHeight, DTA_KeepRatio, true, DTA_ScaleX, NotifyFontScale, DTA_ScaleY, NotifyFontScale);
screen.DrawText(textFont, messageSelection == 1? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, destWidth / 2, y + fontheight, Stringtable.Localize("$TXT_NO"), DTA_VirtualWidth, destWidth, DTA_VirtualHeight, destHeight, DTA_KeepRatio, true); screen.DrawText(textFont, messageSelection == 1? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, destWidth / 2, y + fontheight, Stringtable.Localize("$TXT_NO"), DTA_VirtualWidth, destWidth, DTA_VirtualHeight, destHeight, DTA_KeepRatio, true, DTA_ScaleX, NotifyFontScale, DTA_ScaleY, NotifyFontScale);
if (messageSelection >= 0) if (messageSelection >= 0)
{ {