From 902cefaa417e8d9135ce30c4075e81d4c485139a Mon Sep 17 00:00:00 2001 From: yexo Date: Sun, 4 Jul 2010 12:49:51 +0000 Subject: (svn r20077) -Codechange: remove the space between "open" and "ttd" in the title screen --- src/main_gui.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/main_gui.cpp') diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 80ea150f8..09ef1b275 100644 --- 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; + } } } -- cgit v1.2.3-54-g00ecf