mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-22 10:02:01 +00:00
HUD: switch viewpoint text to thin font if it becomes too wide
- 200 px limit in Race (GTR_CIRCUIT) - 100 px limit in Battle (GTR_BUMPERS)
This commit is contained in:
parent
1da7a5c1da
commit
a7ca3c1768
1 changed files with 19 additions and 3 deletions
|
|
@ -1286,6 +1286,24 @@ static void ST_overlayDrawer(void)
|
|||
INT32 y = (BASEVIDHEIGHT / (r_splitscreen + 1)) - 34;
|
||||
INT32 width = 50;
|
||||
|
||||
const char *text = player_names[stplyr-players];
|
||||
int font = KART_FONT;
|
||||
fixed_t textwidth = V_StringScaledWidth(FRACUNIT, FRACUNIT, FRACUNIT, flags, font, text);
|
||||
fixed_t threshold = textwidth;
|
||||
|
||||
// k_drawKartHUD
|
||||
if (gametyperules & GTR_CIRCUIT)
|
||||
threshold = 200*FRACUNIT;
|
||||
else if (gametyperules & GTR_BUMPERS)
|
||||
threshold = 100*FRACUNIT;
|
||||
|
||||
if (LUA_HudEnabled(hud_gametypeinfo) && textwidth > threshold)
|
||||
{
|
||||
y += 5;
|
||||
font = TINY_FONT;
|
||||
textwidth = V_StringScaledWidth(FRACUNIT, FRACUNIT, FRACUNIT, flags, font, text);
|
||||
}
|
||||
|
||||
if (r_splitscreen)
|
||||
{
|
||||
flags = (flags & ~V_ALPHAMASK) | V_HUDTRANSHALF;
|
||||
|
|
@ -1297,10 +1315,8 @@ static void ST_overlayDrawer(void)
|
|||
V_DrawCenteredThinString(x, y, flags | V_ORANGEMAP, "Watching");
|
||||
}
|
||||
|
||||
const char *text = player_names[stplyr-players];
|
||||
fixed_t textwidth = V_StringScaledWidth(FRACUNIT, FRACUNIT, FRACUNIT, flags, KART_FONT, text);
|
||||
V_DrawStringScaled(x*FRACUNIT - textwidth/2, (y+10)*FRACUNIT,
|
||||
FRACUNIT, FRACUNIT, FRACUNIT, flags, NULL, KART_FONT, text);
|
||||
FRACUNIT, FRACUNIT, FRACUNIT, flags, NULL, font, text);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue