diff options
| author | oy <Tom_Adams@web.de> | 2010-09-12 13:06:55 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2010-09-12 13:06:55 +0200 |
| commit | daab7fdcd4b5cb40161ad137df1632fdaa370a22 (patch) | |
| tree | 97ed0b71e8011bccd5d4cf9b2c9979cd6f0b3af8 /src/game/client/components | |
| parent | fa9c8ee77f86d112df699e84053c00ac5780cfd6 (diff) | |
| download | zcatch-daab7fdcd4b5cb40161ad137df1632fdaa370a22.tar.gz zcatch-daab7fdcd4b5cb40161ad137df1632fdaa370a22.zip | |
fixed that score overlaps in the scoreboard. Closes #161
Diffstat (limited to 'src/game/client/components')
| -rw-r--r-- | src/game/client/components/scoreboard.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp index 7d5530c6..7ea7cfc9 100644 --- a/src/game/client/components/scoreboard.cpp +++ b/src/game/client/components/scoreboard.cpp @@ -229,8 +229,13 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch Graphics()->QuadsEnd(); } - str_format(aBuf, sizeof(aBuf), "%4d", pInfo->m_Score); - TextRender()->Text(0, x+60-TextRender()->TextWidth(0, FontSize,aBuf,-1), y, FontSize, aBuf, -1); + float FontSizeResize = FontSize; + float Width; + const float ScoreWidth = 60.0f; + str_format(aBuf, sizeof(aBuf), "%d", clamp(pInfo->m_Score, -9999, 9999)); + while((Width = TextRender()->TextWidth(0, FontSizeResize, aBuf, -1)) > ScoreWidth) + --FontSizeResize; + TextRender()->Text(0, x+ScoreWidth-Width, y+(FontSize-FontSizeResize)/2, FontSizeResize, aBuf, -1); float FontSizeName = FontSize; while(TextRender()->TextWidth(0, FontSizeName, m_pClient->m_aClients[pInfo->m_ClientId].m_aName, -1) > w-200) |