- 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"); let fonth = font.GetGlyphHeight("A");
if (drawit) if (drawit)
{ {
int width = font.StringWidth(title);
double scalex = (gameinfo.gameType & GAMEFLAG_RRALL)? 0.4 : 1.; double scalex = (gameinfo.gameType & GAMEFLAG_RRALL)? 0.4 : 1.;
double width = font.StringWidth(title);
double scaley = scalex; double scaley = scalex;
if (texid.isValid()) if (texid.isValid())
{ {
screen.DrawTexture(texid, false, 160, 19, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_CenterOffsetRel, true, DTA_Color, 0xff808080); 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); 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 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. double ymid = desc.mItems[desc.mSelectedItem].GetY() + 7; // half height must be hardcoded or layouts will break.
DrawCursor(160 + cursorOffset, ymid, cursorScale, false); DrawCursor(160 + cursorOffset, ymid, cursorScale, false);
DrawCursor(169 - cursorOffset, ymid, cursorScale, true); DrawCursor(160 - cursorOffset, ymid, cursorScale, true);
return true; return true;
} }
@ -143,7 +143,7 @@ class ListMenuItemDukeTextItem : ListMenuItemTextItem
int trans = mColorSelected? Translation.MakeID(Translation_Remap, 1) : 0; int trans = mColorSelected? Translation.MakeID(Translation_Remap, 1) : 0;
Color pe; Color pe;
double scale = (gameinfo.gametype & GAMEFLAG_RRALL) ? 0.4 : 1.; 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) if (selected)
{ {

View File

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