Skip to content

Commit

Permalink
- Proportion banner text consistently based on the smallest scale req…
Browse files Browse the repository at this point in the history
…uired.
  • Loading branch information
emukidid committed Mar 21, 2024
1 parent 58a9f33 commit 52e0c30
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cube/swiss/source/swiss.c
Original file line number Diff line number Diff line change
Expand Up @@ -2388,9 +2388,14 @@ uiDrawObj_t* draw_game_info() {
char* rest = &txtbuffer[0];
char* tok;
int line = 0;
float minScale = 1.0f;
while ((tok = strtok_r (rest,"\r\n", &rest))) {
float scale = GetTextScaleToFitInWidth(tok,(getVideoMode()->fbWidth-78)-75);
DrawAddChild(container, DrawStyledLabel(640/2, 315+(line*scale*24), tok, scale, true, defaultColor));
minScale = MIN(GetTextScaleToFitInWidth(tok,(getVideoMode()->fbWidth-78)-75), minScale);
}
sprintf(txtbuffer, "%s", curFile.meta->bannerDesc.description);
rest = &txtbuffer[0];
while ((tok = strtok_r (rest,"\r\n", &rest))) {
DrawAddChild(container, DrawStyledLabel(640/2, 315+(line*minScale*24), tok, minScale, true, defaultColor));
line++;
}
}
Expand Down

0 comments on commit 52e0c30

Please sign in to comment.