mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-12 19:18:20 +00:00
revert the score board
Signed-off-by: GreYFoXGTi <GreYFoXGTi@GMaiL.CoM>
This commit is contained in:
parent
fa379a806a
commit
3ffbd91fca
|
@ -243,10 +243,6 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
||||||
// make sure that we render the correct team
|
// make sure that we render the correct team
|
||||||
|
|
||||||
char aBuf[128];
|
char aBuf[128];
|
||||||
float FontSizeResize = FontSize;
|
|
||||||
float Width;
|
|
||||||
const float ScoreWidth = 60.0f;
|
|
||||||
const float PingWidth = 60.0f;
|
|
||||||
if(pInfo->m_Local)
|
if(pInfo->m_Local)
|
||||||
{
|
{
|
||||||
// background so it's easy to find the local player
|
// background so it's easy to find the local player
|
||||||
|
@ -256,6 +252,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
||||||
RenderTools()->DrawRoundRect(x, y, w-20, LineHeight*0.95f, 17.0f);
|
RenderTools()->DrawRoundRect(x, y, w-20, LineHeight*0.95f, 17.0f);
|
||||||
Graphics()->QuadsEnd();
|
Graphics()->QuadsEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_pClient->m_IsRace)
|
if(m_pClient->m_IsRace)
|
||||||
{
|
{
|
||||||
float Time = m_pClient->m_aClients[pInfo->m_ClientId].m_Score;
|
float Time = m_pClient->m_aClients[pInfo->m_ClientId].m_Score;
|
||||||
|
@ -267,15 +264,13 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
str_format(aBuf, sizeof(aBuf), "%d", clamp(pInfo->m_Score, -9999, 9999));
|
str_format(aBuf, sizeof(aBuf), "%4d", pInfo->m_Score);
|
||||||
while((Width = TextRender()->TextWidth(0, FontSizeResize, aBuf, -1)) > ScoreWidth)
|
TextRender()->Text(0, x+60-TextRender()->TextWidth(0, FontSize,aBuf,-1), y, FontSize, aBuf, -1);
|
||||||
--FontSizeResize;
|
|
||||||
TextRender()->Text(0, x+ScoreWidth-Width, y+(FontSize-FontSizeResize)/2, FontSizeResize, aBuf, -1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FontSizeResize = FontSize;
|
float FontSizeName = FontSize;
|
||||||
while(TextRender()->TextWidth(0, FontSizeResize, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1) > w-163.0f-PingWidth)
|
while(TextRender()->TextWidth(0, FontSizeName, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1) > w-200)
|
||||||
--FontSizeResize;
|
--FontSizeName;
|
||||||
CGameClient::CClientData currentData = m_pClient->m_aClients[pInfo->m_ClientId];
|
CGameClient::CClientData currentData = m_pClient->m_aClients[pInfo->m_ClientId];
|
||||||
TextRender()->TextColor(
|
TextRender()->TextColor(
|
||||||
(float)(m_PredefinedColors[pInfo->m_ClientId].r)/255.0f,
|
(float)(m_PredefinedColors[pInfo->m_ClientId].r)/255.0f,
|
||||||
|
@ -284,22 +279,16 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
||||||
if(m_pClient->m_IsRace)
|
if(m_pClient->m_IsRace)
|
||||||
{
|
{
|
||||||
CTextCursor Cursor;
|
CTextCursor Cursor;
|
||||||
TextRender()->SetCursor(&Cursor, x+128+DataOffset, y+(FontSize-FontSizeResize)/2, FontSizeResize, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
TextRender()->SetCursor(&Cursor, x+128+DataOffset, y+(FontSize-FontSizeName)/2, FontSizeName, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||||
Cursor.m_LineWidth = 400;
|
Cursor.m_LineWidth = 400;
|
||||||
TextRender()->TextEx(&Cursor, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1);
|
TextRender()->TextEx(&Cursor, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
TextRender()->Text(0, x+128+DataOffset, y+(FontSize-FontSizeResize)/2, FontSizeResize, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1);
|
TextRender()->Text(0, x+128+DataOffset, y+(FontSize-FontSizeName)/2, FontSizeName, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1);
|
||||||
|
|
||||||
str_format(aBuf, sizeof(aBuf), "%4d", pInfo->m_Latency);
|
str_format(aBuf, sizeof(aBuf), "%4d", pInfo->m_Latency);
|
||||||
float tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
float tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||||
//TextRender()->Text(0, x+w-tw-35, y, FontSize, aBuf, -1);
|
TextRender()->Text(0, x+w-tw-35, y, FontSize, aBuf, -1);
|
||||||
TextRender()->Text(0, x+128.0f, y+(FontSize-FontSizeResize)/2, FontSizeResize, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1);
|
|
||||||
FontSizeResize = FontSize;
|
|
||||||
str_format(aBuf, sizeof(aBuf), "%d", clamp(pInfo->m_Latency, -9999, 9999));
|
|
||||||
while((Width = TextRender()->TextWidth(0, FontSizeResize, aBuf, -1)) > PingWidth)
|
|
||||||
--FontSizeResize;
|
|
||||||
TextRender()->Text(0, x+w-35.0f-Width, y+(FontSize-FontSizeResize)/2, FontSizeResize, aBuf, -1);
|
|
||||||
|
|
||||||
// render avatar
|
// render avatar
|
||||||
if((m_pClient->m_Snap.m_paFlags[0] && m_pClient->m_Snap.m_paFlags[0]->m_CarriedBy == pInfo->m_ClientId) ||
|
if((m_pClient->m_Snap.m_paFlags[0] && m_pClient->m_Snap.m_paFlags[0]->m_CarriedBy == pInfo->m_ClientId) ||
|
||||||
|
|
Loading…
Reference in a new issue