mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Some text positioning
This commit is contained in:
parent
3118ad4069
commit
8cc0de8d31
|
@ -166,7 +166,7 @@ void CKillMessages::OnRender()
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_aKillmsgs[r].m_VictimTextContainerIndex != -1)
|
if(m_aKillmsgs[r].m_VictimTextContainerIndex != -1)
|
||||||
TextRender()->RenderTextContainer(m_aKillmsgs[r].m_VictimTextContainerIndex, &TColor, &TOutlineColor, x, y);
|
TextRender()->RenderTextContainer(m_aKillmsgs[r].m_VictimTextContainerIndex, &TColor, &TOutlineColor, x, y + (46.f - 36.f) / 2.f);
|
||||||
|
|
||||||
// render victim tee
|
// render victim tee
|
||||||
x -= 24.0f;
|
x -= 24.0f;
|
||||||
|
@ -221,7 +221,7 @@ void CKillMessages::OnRender()
|
||||||
x -= m_aKillmsgs[r].m_KillerTextWidth;
|
x -= m_aKillmsgs[r].m_KillerTextWidth;
|
||||||
|
|
||||||
if(m_aKillmsgs[r].m_KillerTextContainerIndex != -1)
|
if(m_aKillmsgs[r].m_KillerTextContainerIndex != -1)
|
||||||
TextRender()->RenderTextContainer(m_aKillmsgs[r].m_KillerTextContainerIndex, &TColor, &TOutlineColor, x, y);
|
TextRender()->RenderTextContainer(m_aKillmsgs[r].m_KillerTextContainerIndex, &TColor, &TOutlineColor, x, y + (46.f - 36.f) / 2.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
y += 46.0f;
|
y += 46.0f;
|
||||||
|
|
|
@ -112,7 +112,7 @@ void CScoreboard::RenderSpectators(float x, float y, float w)
|
||||||
|
|
||||||
// Headline
|
// Headline
|
||||||
y += 10.0f;
|
y += 10.0f;
|
||||||
TextRender()->Text(0, x+10.0f, y, 28.0f, Localize("Spectators"), w-20.0f);
|
TextRender()->Text(0, x+10.0f, y + (30.f - 28.f) / 2.f, 28.0f, Localize("Spectators"), w-20.0f);
|
||||||
|
|
||||||
// spectator names
|
// spectator names
|
||||||
y += 30.0f;
|
y += 30.0f;
|
||||||
|
@ -195,7 +195,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
||||||
else
|
else
|
||||||
pTitle = Localize("Score board");
|
pTitle = Localize("Score board");
|
||||||
}
|
}
|
||||||
TextRender()->Text(0, x+20.0f, y, TitleFontsize, pTitle, -1);
|
TextRender()->Text(0, x+20.0f, y + (50.f - TitleFontsize) / 2.f, TitleFontsize, pTitle, -1);
|
||||||
|
|
||||||
char aBuf[128] = {0};
|
char aBuf[128] = {0};
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
||||||
if (!lower16 && !lower32 && !lower24)
|
if (!lower16 && !lower32 && !lower24)
|
||||||
{
|
{
|
||||||
tw = TextRender()->TextWidth(0, TitleFontsize, aBuf, -1);
|
tw = TextRender()->TextWidth(0, TitleFontsize, aBuf, -1);
|
||||||
TextRender()->Text(0, x+w-tw-20.0f, y, TitleFontsize, aBuf, -1);
|
TextRender()->Text(0, x+w-tw-20.0f, y + (50.f - TitleFontsize) / 2.f, TitleFontsize, aBuf, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate measurements
|
// calculate measurements
|
||||||
|
@ -287,15 +287,15 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
||||||
float HeadlineFontsize = 22.0f;
|
float HeadlineFontsize = 22.0f;
|
||||||
float ScoreWidth = TextRender()->TextWidth(0, HeadlineFontsize, Localize("Score"), -1);
|
float ScoreWidth = TextRender()->TextWidth(0, HeadlineFontsize, Localize("Score"), -1);
|
||||||
tw = ScoreLength > ScoreWidth ? ScoreLength : ScoreWidth;
|
tw = ScoreLength > ScoreWidth ? ScoreLength : ScoreWidth;
|
||||||
TextRender()->Text(0, ScoreOffset+ScoreLength-tw, y, HeadlineFontsize, Localize("Score"), -1);
|
TextRender()->Text(0, ScoreOffset+ScoreLength-tw, y + (HeadlineFontsize * 2.f - HeadlineFontsize) / 2.f, HeadlineFontsize, Localize("Score"), -1);
|
||||||
|
|
||||||
TextRender()->Text(0, NameOffset, y, HeadlineFontsize, Localize("Name"), -1);
|
TextRender()->Text(0, NameOffset, y + (HeadlineFontsize * 2.f - HeadlineFontsize) / 2.f, HeadlineFontsize, Localize("Name"), -1);
|
||||||
|
|
||||||
tw = TextRender()->TextWidth(0, HeadlineFontsize, Localize("Clan"), -1);
|
tw = TextRender()->TextWidth(0, HeadlineFontsize, Localize("Clan"), -1);
|
||||||
TextRender()->Text(0, ClanOffset+ClanLength/2-tw/2, y, HeadlineFontsize, Localize("Clan"), -1);
|
TextRender()->Text(0, ClanOffset+ClanLength/2-tw/2, y + (HeadlineFontsize * 2.f - HeadlineFontsize) / 2.f, HeadlineFontsize, Localize("Clan"), -1);
|
||||||
|
|
||||||
tw = TextRender()->TextWidth(0, HeadlineFontsize, Localize("Ping"), -1);
|
tw = TextRender()->TextWidth(0, HeadlineFontsize, Localize("Ping"), -1);
|
||||||
TextRender()->Text(0, PingOffset+PingLength-tw, y, HeadlineFontsize, Localize("Ping"), -1);
|
TextRender()->Text(0, PingOffset+PingLength-tw, y + (HeadlineFontsize * 2.f - HeadlineFontsize) / 2.f, HeadlineFontsize, Localize("Ping"), -1);
|
||||||
|
|
||||||
// render player entries
|
// render player entries
|
||||||
y += HeadlineFontsize*2.0f;
|
y += HeadlineFontsize*2.0f;
|
||||||
|
|
|
@ -439,7 +439,7 @@ void CRenderTools::RenderTeleOverlay(CTeleTile *pTele, int w, int h, float Scale
|
||||||
char aBuf[16];
|
char aBuf[16];
|
||||||
str_format(aBuf, sizeof(aBuf), "%d", Index);
|
str_format(aBuf, sizeof(aBuf), "%d", Index);
|
||||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha);
|
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha);
|
||||||
UI()->TextRender()->Text(0, mx*Scale-2, my*Scale-4, Scale-5, aBuf, -1);
|
UI()->TextRender()->Text(0, mx*Scale - 3.f, my*Scale, Scale - 5.f, aBuf, -1);
|
||||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -498,13 +498,13 @@ void CRenderTools::RenderSpeedupOverlay(CSpeedupTile *pSpeedup, int w, int h, fl
|
||||||
char aBuf[16];
|
char aBuf[16];
|
||||||
str_format(aBuf, sizeof(aBuf), "%d", Force);
|
str_format(aBuf, sizeof(aBuf), "%d", Force);
|
||||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha);
|
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha);
|
||||||
UI()->TextRender()->Text(0, mx*Scale, my*Scale+16, Scale-20, aBuf, -1);
|
UI()->TextRender()->Text(0, mx*Scale, (my*Scale) + 16.f + ((16.f - (Scale - 20.f)) / 2.f), Scale - 20.f, aBuf, -1);
|
||||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
if(MaxSpeed)
|
if(MaxSpeed)
|
||||||
{
|
{
|
||||||
str_format(aBuf, sizeof(aBuf), "%d", MaxSpeed);
|
str_format(aBuf, sizeof(aBuf), "%d", MaxSpeed);
|
||||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha);
|
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha);
|
||||||
UI()->TextRender()->Text(0, mx*Scale, my*Scale-2, Scale-20, aBuf, -1);
|
UI()->TextRender()->Text(0, mx*Scale, (my*Scale) + ((16.f - (Scale - 20.f)) / 2.f), Scale - 20.f, aBuf, -1);
|
||||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -553,7 +553,7 @@ void CRenderTools::RenderSwitchOverlay(CSwitchTile *pSwitch, int w, int h, float
|
||||||
char aBuf[16];
|
char aBuf[16];
|
||||||
str_format(aBuf, sizeof(aBuf), "%d", Index);
|
str_format(aBuf, sizeof(aBuf), "%d", Index);
|
||||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha);
|
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha);
|
||||||
UI()->TextRender()->Text(0, mx*Scale, my*Scale+16, Scale-20, aBuf, -1);
|
UI()->TextRender()->Text(0, mx*Scale, my*Scale + 16.f + ((16.f - (Scale - 20.f)) / 2.f), Scale - 20.f, aBuf, -1);
|
||||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -563,7 +563,7 @@ void CRenderTools::RenderSwitchOverlay(CSwitchTile *pSwitch, int w, int h, float
|
||||||
char aBuf[16];
|
char aBuf[16];
|
||||||
str_format(aBuf, sizeof(aBuf), "%d", Delay);
|
str_format(aBuf, sizeof(aBuf), "%d", Delay);
|
||||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha);
|
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha);
|
||||||
UI()->TextRender()->Text(0, mx*Scale, my*Scale-2, Scale-20, aBuf, -1);
|
UI()->TextRender()->Text(0, mx*Scale, my*Scale + ((16.f - (Scale - 20.f)) / 2.f), Scale - 20.f, aBuf, -1);
|
||||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue