File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -961,6 +961,11 @@ procedure TSingScores.DrawScore(const Index: integer);
961961var
962962 Position: TScorePosition;
963963 ScoreStr: String;
964+ TextSize: integer;
965+ TextW: real;
966+ MaxTextW: real;
967+ Scale: real;
968+ TextX: real;
964969 Drawing: boolean;
965970begin
966971 Drawing := false;
@@ -995,10 +1000,6 @@ procedure TSingScores.DrawScore(const Index: integer);
9951000 glDisable(GL_BLEND);
9961001
9971002 // draw score text
998- ScoreStr := InttoStr(Players[Index].ScoreDisplayed div 10 ) + ' 0' ;
999- while (Length(ScoreStr) < 5 ) do
1000- ScoreStr := ' 0' + ScoreStr;
1001-
10021003 SetFontFamily(Position.TextFont);
10031004 SetFontStyle(Position.TextStyle);
10041005 SetFontItalic(false);
@@ -1008,6 +1009,21 @@ procedure TSingScores.DrawScore(const Index: integer);
10081009 while (Length(ScoreStr) < 5 ) do
10091010 ScoreStr := ' 0' + ScoreStr;
10101011
1012+ TextSize := Position.TextSize;
1013+ SetFontSize(TextSize);
1014+ TextW := glTextWidth(ScoreStr);
1015+
1016+ MaxTextW := Max(0 , Position.BGW - 8 );
1017+ if (TextW > 0 ) and (TextW > MaxTextW) then
1018+ begin
1019+ Scale := MaxTextW / TextW;
1020+ TextSize := Max(1 , Round(TextSize * Scale));
1021+ SetFontSize(TextSize);
1022+ TextW := glTextWidth(ScoreStr);
1023+ end ;
1024+
1025+ TextX := Position.BGX + (Position.BGW - TextW) / 2 ;
1026+ SetFontPos(TextX, Position.TextY);
10111027 glPrint(ScoreStr);
10121028 end ; // eo player has position
10131029end ;
You can’t perform that action at this time.
0 commit comments