- fixed some menu alignment issues

* the left selector in Duke was misplaced to the right.
* some issues with incomplete handling of RR's downscaled fonts.
* give SW's caption bar a little more space on the edges.
This commit is contained in:
Christoph Oelckers 2020-10-13 22:53:27 +02:00
parent ef15ac8b6e
commit 127440f03c
2 changed files with 6 additions and 6 deletions

View file

@ -9,13 +9,13 @@ class DukeMenuDelegate : RazeMenuDelegate
let fonth = font.GetGlyphHeight("A");
if (drawit)
{
int width = font.StringWidth(title);
double scalex = (gameinfo.gameType & GAMEFLAG_RRALL)? 0.4 : 1.;
double width = font.StringWidth(title);
double scaley = scalex;
if (texid.isValid())
{
screen.DrawTexture(texid, false, 160, 19, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_CenterOffsetRel, true, DTA_Color, 0xff808080);
if (texsize.X - 30 < width) scalex = (texsize.X - 30) / width; // Squash the text if it doesn't fit.
if (texsize.X - 30 < width * scalex) scalex = (texsize.X - 30) / (width); // Squash the text if it doesn't fit.
}
screen.DrawText(font, Font.CR_UNTRANSLATED, 160 - width / 2 * scalex, 19 - fonth / 2 * scaley, title, DTA_ScaleX, scalex, DTA_ScaleY, scaley, DTA_FullscreenScale, FSMode_Fit320x200Top);
}
@ -49,7 +49,7 @@ class DukeMenuDelegate : RazeMenuDelegate
double cursorScale = (gameinfo.gametype & GAMEFLAG_RRALL) ? 0.2 : 1.0;
double ymid = desc.mItems[desc.mSelectedItem].GetY() + 7; // half height must be hardcoded or layouts will break.
DrawCursor(160 + cursorOffset, ymid, cursorScale, false);
DrawCursor(169 - cursorOffset, ymid, cursorScale, true);
DrawCursor(160 - cursorOffset, ymid, cursorScale, true);
return true;
}
@ -143,7 +143,7 @@ class ListMenuItemDukeTextItem : ListMenuItemTextItem
int trans = mColorSelected? Translation.MakeID(Translation_Remap, 1) : 0;
Color pe;
double scale = (gameinfo.gametype & GAMEFLAG_RRALL) ? 0.4 : 1.;
let xpos = mXpos - BigFont.StringWidth(mText) * scale * 0.5;
let xpos = 160 - BigFont.StringWidth(mText) * scale * 0.5;
if (selected)
{

View file

@ -17,13 +17,13 @@ class SWMenuDelegate : RazeMenuDelegate
if (texsize.X - 60 < width)
{
// First start squashing the font down to 0.7x the original width.
fontscale = (texsize.X - 60) / width;
fontscale = (texsize.X - 66) / width;
if (fontscale < 0.7)
{
// If that is not enough, extend the box.
fontscale = 0.7;
width *= 0.7;
scalex = width / (texsize.X - 60);
scalex = width / (texsize.X - 66);
}
else width *= fontscale;
}