diff src/main_gui.cpp @ 15434:995eaf7f493c draft

(svn r20077) -Codechange: remove the space between "open" and "ttd" in the title screen
author yexo <yexo@openttd.org>
date Sun, 04 Jul 2010 12:49:51 +0000 (2010-07-04)
parents d730740247bc
children 683f2dbe75bb
line wrap: on
line diff
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -245,16 +245,19 @@
 	{
 		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;
+			}
 		}
 	}