1
0
Fork 0

Fix: title positioning on HiDPI displays

pull/10013/head
Bouke Haarsma 2022-09-04 14:53:15 +02:00 committed by Michael Lutz
parent 2d2a5dd966
commit 18c210b013
1 changed files with 4 additions and 4 deletions

View File

@ -248,8 +248,8 @@ struct MainWindow : Window
this->DrawWidgets(); this->DrawWidgets();
if (_game_mode == GM_MENU) { if (_game_mode == GM_MENU) {
static const SpriteID title_sprites[] = {SPR_OTTD_O, SPR_OTTD_P, SPR_OTTD_E, SPR_OTTD_N, SPR_OTTD_T, SPR_OTTD_T, SPR_OTTD_D}; static const SpriteID title_sprites[] = {SPR_OTTD_O, SPR_OTTD_P, SPR_OTTD_E, SPR_OTTD_N, SPR_OTTD_T, SPR_OTTD_T, SPR_OTTD_D};
static const uint LETTER_SPACING = 10; uint letter_spacing = ScaleGUITrad(10);
int name_width = (lengthof(title_sprites) - 1) * LETTER_SPACING; int name_width = (lengthof(title_sprites) - 1) * letter_spacing;
for (uint i = 0; i < lengthof(title_sprites); i++) { for (uint i = 0; i < lengthof(title_sprites); i++) {
name_width += GetSpriteSize(title_sprites[i]).width; name_width += GetSpriteSize(title_sprites[i]).width;
@ -257,8 +257,8 @@ struct MainWindow : Window
int off_x = (this->width - name_width) / 2; int off_x = (this->width - name_width) / 2;
for (uint i = 0; i < lengthof(title_sprites); i++) { for (uint i = 0; i < lengthof(title_sprites); i++) {
DrawSprite(title_sprites[i], PAL_NONE, off_x, 50); DrawSprite(title_sprites[i], PAL_NONE, off_x, ScaleGUITrad(50));
off_x += GetSpriteSize(title_sprites[i]).width + LETTER_SPACING; off_x += GetSpriteSize(title_sprites[i]).width + letter_spacing;
} }
} }
} }