From 48bf4a4a628857e1e0ff423f3eafb73abd6cc8be Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Sun, 27 Mar 2011 23:15:45 +0200 Subject: [PATCH] online and offline highscores are now better displayed --- asteroids/View.cc | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/asteroids/View.cc b/asteroids/View.cc index 046ff90..3f08ea2 100644 --- a/asteroids/View.cc +++ b/asteroids/View.cc @@ -851,25 +851,48 @@ void View::DrawHighscoreEntry (float x, float y, float entry_width, const std::s } void View::DrawUiHighscore() { - DrawPageTitle ("Highscores"); + // DrawPageTitle but centered: + SelectFont("console.ttf size=46 color=#808080"); + + float width, height; + DrawGLStringMeasure("Highscores", &width, &height); + + float xpos = (screen_right - width) * 0.5; + float ypos = 180; + Engine::GUI::Label (4, "Highscores", xpos - 2, ypos + 2); + + SelectFont("console.ttf size=46 color=#ffffff"); + Engine::GUI::Label (4, "Highscores", xpos, ypos); if (GetModel()->GetHighscoreIsOnline()) { - SelectFont("console.ttf size=23 color=#006600"); + SelectFont("console.ttf size=23 color=#887500"); std::string title= "-online-"; float width, height; DrawGLStringMeasure(title.c_str(), &width, &height); - float xpos = (screen_right - width) * 0.5 - 40; + float xpos = (screen_right - width) * 0.5; float ypos = 130; - Engine::GUI::Label (4, title.c_str(), xpos - 2, ypos + 2); + Engine::GUI::Label (4, title.c_str(), xpos - 1, ypos + 1); - SelectFont("console.ttf size=23 color=#00cf00"); + SelectFont("console.ttf size=23 color=#e8d500"); + Engine::GUI::Label (4, title.c_str(), xpos, ypos); + } else { + SelectFont("console.ttf size=23 color=#808080"); + std::string title= "-offline-"; + float width, height; + DrawGLStringMeasure(title.c_str(), &width, &height); + + float xpos = (screen_right - width) * 0.5; + float ypos = 130; + Engine::GUI::Label (4, title.c_str(), xpos - 1, ypos + 1); + + SelectFont("console.ttf size=23 color=#ffffff"); Engine::GUI::Label (4, title.c_str(), xpos, ypos); } SelectFont ("console.ttf size=23"); unsigned int entry_length = 32; - float char_width, height; + float char_width; DrawGLStringMeasure ("M", &char_width, &height); height = fabsf(height); float entry_width = fabsf(char_width * entry_length);