mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Fix statboard size for 4:3 and 5:4 screens (fixes #211)
This commit is contained in:
parent
1ef03e7387
commit
1aeea28459
|
@ -136,7 +136,7 @@ void CStatboard::RenderGlobalStats()
|
|||
{
|
||||
const float StatboardWidth = 400*3.0f*Graphics()->ScreenAspect();
|
||||
const float StatboardHeight = 400*3.0f;
|
||||
float StatboardContentWidth = 250.0f;
|
||||
float StatboardContentWidth = 210.0f;
|
||||
float StatboardContentHeight = 750.0f;
|
||||
|
||||
const CNetObj_PlayerInfo *apPlayers[MAX_CLIENTS] = {0};
|
||||
|
@ -177,7 +177,7 @@ void CStatboard::RenderGlobalStats()
|
|||
bool gameWithFlags = m_pClient->m_Snap.m_pGameInfoObj &&
|
||||
m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_FLAGS;
|
||||
|
||||
StatboardContentWidth += 6 * 100 + 110 + 140; // Best spree 140; Suicides 110; other labels 100
|
||||
StatboardContentWidth += 7 * 85 + 95; // Suicides 95; other labels 85
|
||||
|
||||
if(gameWithFlags)
|
||||
StatboardContentWidth += 200; // Grabs & Flags
|
||||
|
@ -208,23 +208,21 @@ void CStatboard::RenderGlobalStats()
|
|||
float tw;
|
||||
int px = 325;
|
||||
|
||||
TextRender()->Text(0, x+10, y-5, 24.0f, Localize("Name"), -1);
|
||||
TextRender()->Text(0, x+10, y-5, 22.0f, Localize("Name"), -1);
|
||||
const char *apHeaders[] = {
|
||||
Localize("Frags"), Localize("Deaths"), Localize("Suicides"),
|
||||
Localize("Ratio"), Localize("Net"), Localize("FPM"),
|
||||
Localize("Spree"), Localize("Best spree"), Localize("Grabs")
|
||||
Localize("Spree"), Localize("Best"), Localize("Grabs")
|
||||
};
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
if(i == 2)
|
||||
px += 10.0f; // Suicides
|
||||
if(i == 7) // Best Spree
|
||||
px += 40.0f;
|
||||
if(i == 8 && !gameWithFlags) // Don't draw "Grabs" in game with no flag
|
||||
continue;
|
||||
tw = TextRender()->TextWidth(0, 24.0f, apHeaders[i], -1);
|
||||
TextRender()->Text(0, x+px-tw, y-5, 24.0f, apHeaders[i], -1);
|
||||
px += 100;
|
||||
tw = TextRender()->TextWidth(0, 22.0f, apHeaders[i], -1);
|
||||
TextRender()->Text(0, x+px-tw, y-5, 22.0f, apHeaders[i], -1);
|
||||
px += 85;
|
||||
}
|
||||
|
||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
|
||||
|
@ -259,16 +257,16 @@ void CStatboard::RenderGlobalStats()
|
|||
|
||||
y += 29.0f;
|
||||
|
||||
float FontSize = 30.0f;
|
||||
float FontSize = 24.0f;
|
||||
float LineHeight = 50.0f;
|
||||
float TeeSizemod = 1.0f;
|
||||
float TeeSizemod = 0.8f;
|
||||
float TeeOffset = 0.0f;
|
||||
|
||||
if(NumPlayers > 14)
|
||||
{
|
||||
FontSize = 30.0f;
|
||||
FontSize = 24.0f;
|
||||
LineHeight = 40.0f;
|
||||
TeeSizemod = 0.8f;
|
||||
TeeSizemod = 0.7f;
|
||||
TeeOffset = -5.0f;
|
||||
}
|
||||
|
||||
|
@ -306,14 +304,14 @@ void CStatboard::RenderGlobalStats()
|
|||
str_format(aBuf, sizeof(aBuf), "%d", Stats.m_Frags);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
|
||||
px += 100;
|
||||
px += 85;
|
||||
}
|
||||
// DEATHS
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%d", Stats.m_Deaths);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
|
||||
px += 100;
|
||||
px += 85;
|
||||
}
|
||||
// SUICIDES
|
||||
{
|
||||
|
@ -321,7 +319,7 @@ void CStatboard::RenderGlobalStats()
|
|||
str_format(aBuf, sizeof(aBuf), "%d", Stats.m_Suicides);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
|
||||
px += 100;
|
||||
px += 85;
|
||||
}
|
||||
// RATIO
|
||||
{
|
||||
|
@ -331,14 +329,14 @@ void CStatboard::RenderGlobalStats()
|
|||
str_format(aBuf, sizeof(aBuf), "%.2f", (float)(Stats.m_Frags)/Stats.m_Deaths);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
|
||||
px += 100;
|
||||
px += 85;
|
||||
}
|
||||
// NET
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%+d", Stats.m_Frags-Stats.m_Deaths);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
|
||||
px += 100;
|
||||
px += 85;
|
||||
}
|
||||
// FPM
|
||||
{
|
||||
|
@ -346,22 +344,21 @@ void CStatboard::RenderGlobalStats()
|
|||
str_format(aBuf, sizeof(aBuf), "%.1f", Fpm);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
|
||||
px += 100;
|
||||
px += 85;
|
||||
}
|
||||
// SPREE
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%d", Stats.m_CurrentSpree);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
|
||||
px += 100;
|
||||
px += 85;
|
||||
}
|
||||
// BEST SPREE
|
||||
{
|
||||
px += 40;
|
||||
str_format(aBuf, sizeof(aBuf), "%d", Stats.m_BestSpree);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
|
||||
px += 100;
|
||||
px += 85;
|
||||
}
|
||||
// GRABS
|
||||
if(gameWithFlags)
|
||||
|
@ -369,7 +366,7 @@ void CStatboard::RenderGlobalStats()
|
|||
str_format(aBuf, sizeof(aBuf), "%d", Stats.m_FlagGrabs);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
|
||||
px += 100;
|
||||
px += 85;
|
||||
}
|
||||
// WEAPONS
|
||||
px -= 40;
|
||||
|
@ -389,7 +386,7 @@ void CStatboard::RenderGlobalStats()
|
|||
str_format(aBuf, sizeof(aBuf), "%d", Stats.m_FlagCaptures);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y, FontSize, aBuf, -1);
|
||||
px += 100;
|
||||
px += 85;
|
||||
}
|
||||
y += LineHeight;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue