diff --git a/src/main_gui.cpp b/src/main_gui.cpp --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -245,16 +245,19 @@ struct MainWindow : Window { this->DrawWidgets(); if (_game_mode == GM_MENU) { - int off_x = this->width / 2; + 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 name_width = (lengthof(title_sprites) - 1) * LETTER_SPACING; - DrawSprite(SPR_OTTD_O, PAL_NONE, off_x - 120, 50); - DrawSprite(SPR_OTTD_P, PAL_NONE, off_x - 86, 50); - DrawSprite(SPR_OTTD_E, PAL_NONE, off_x - 53, 50); - DrawSprite(SPR_OTTD_N, PAL_NONE, off_x - 22, 50); + for (uint i = 0; i < lengthof(title_sprites); i++) { + name_width += GetSpriteSize(title_sprites[i]).width; + } + int off_x = (this->width - name_width) / 2; - DrawSprite(SPR_OTTD_T, PAL_NONE, off_x + 34, 50); - DrawSprite(SPR_OTTD_T, PAL_NONE, off_x + 65, 50); - DrawSprite(SPR_OTTD_D, PAL_NONE, off_x + 96, 50); + for (uint i = 0; i < lengthof(title_sprites); i++) { + DrawSprite(title_sprites[i], PAL_NONE, off_x, 50); + off_x += GetSpriteSize(title_sprites[i]).width + LETTER_SPACING; + } } }