From c42679a10ef46704e3cbe20a237c37fe3a7cfd3f Mon Sep 17 00:00:00 2001 From: oy Date: Fri, 2 Jul 2010 14:14:41 +0200 Subject: cut too long player names in the server browser. Closes #151 fixed overlapping of too long player names in the scoreboard --- src/game/client/components/scoreboard.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/game/client/components/scoreboard.cpp') diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp index 80330e9c..9558c840 100644 --- a/src/game/client/components/scoreboard.cpp +++ b/src/game/client/components/scoreboard.cpp @@ -226,7 +226,10 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch str_format(aBuf, sizeof(aBuf), "%4d", pInfo->m_Score); TextRender()->Text(0, x+60-TextRender()->TextWidth(0, FontSize,aBuf,-1), y, FontSize, aBuf, -1); - TextRender()->Text(0, x+128, y, FontSize, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1); + float FontSizeName = FontSize; + while(TextRender()->TextWidth(0, FontSizeName, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1) > w-200) + --FontSizeName; + TextRender()->Text(0, x+128, y+(FontSize-FontSizeName)/2, FontSizeName, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1); str_format(aBuf, sizeof(aBuf), "%4d", pInfo->m_Latency); float tw = TextRender()->TextWidth(0, FontSize, aBuf, -1); -- cgit 1.4.1