From 164e4ab0c6df291c8bfd6058ad0592ca26106056 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Wed, 18 Jun 2008 22:40:27 +0100 Subject: [PATCH] Properly align level complete text --- src/Game.cpp | 8 +++++--- src/Game.hpp | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Game.cpp b/src/Game.cpp index 96f63b8..16d615a 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -110,6 +110,7 @@ void Game::CalculateScore(int padIndex) (level * SCORE_LEVEL) + ((MAX_PAD_SIZE + 2 - pads[padIndex].GetLength()) * SCORE_PAD_SIZE) + (fuelmeter.GetFuel() / SCORE_FUEL_DIV); + newscore_width = bigFont.GetStringWidth(i18n("Score: %d"), newscore); } void Game::Process() @@ -613,7 +614,7 @@ void Game::Display() if (state == gsExplode) { ship.DrawExplosion(true); glColor3f(0.0f, 1.0f, 0.0f); - const char *sdeath = i18n("Press SPACE to continue"); + const char *sdeath = i18n("Press SPACE to continue"); int x = (opengl.GetWidth() - normalFont.GetStringWidth(sdeath)) / 2; int y = opengl.GetHeight() - 40; normalFont.Print(x, y, sdeath); @@ -684,9 +685,10 @@ void Game::Display() levelComp.Draw(lc_x, lc_y); glColor3f(0.0f, 0.5f, 0.9f); - int x = (opengl.GetWidth() - bigFont.GetStringWidth(scoretxt) - 40) / 2; + int printScore = newscore > 0 ? newscore : 0; + int x = (opengl.GetWidth() - newscore_width) / 2; int y = (opengl.GetHeight() - 30)/2 + 50; - bigFont.Print(x, y, scoretxt, newscore > 0 ? newscore : 0); + bigFont.Print(x, y, scoretxt, printScore); } // Draw level number text diff --git a/src/Game.hpp b/src/Game.hpp index 09f1949..b1795cd 100644 --- a/src/Game.hpp +++ b/src/Game.hpp @@ -114,7 +114,7 @@ private: bool bDebugMode; float flGravity, starrotate, fade_alpha, life_alpha; TextureQuad fade; - int score, newscore, nextnewlife; + int score, newscore, nextnewlife, newscore_width; int countdown_timeout, leveltext_timeout, levelcomp_timeout; enum GameState { gsNone, gsInGame, gsExplode, gsGameOver, gsDeathWait, -- 2.39.2