about summary refs log tree commit diff
path: root/src/game
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2010-09-12 13:06:55 +0200
committeroy <Tom_Adams@web.de>2010-09-12 13:06:55 +0200
commitdaab7fdcd4b5cb40161ad137df1632fdaa370a22 (patch)
tree97ed0b71e8011bccd5d4cf9b2c9979cd6f0b3af8 /src/game
parentfa9c8ee77f86d112df699e84053c00ac5780cfd6 (diff)
downloadzcatch-daab7fdcd4b5cb40161ad137df1632fdaa370a22.tar.gz
zcatch-daab7fdcd4b5cb40161ad137df1632fdaa370a22.zip
fixed that score overlaps in the scoreboard. Closes #161
Diffstat (limited to 'src/game')
-rw-r--r--src/game/client/components/scoreboard.cpp9
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)