Fixed overlapping of highscore message in GP mode

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8750 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-05-29 21:00:31 +00:00
parent 6e4cee9341
commit 63d224dc62
2 changed files with 43 additions and 34 deletions

View File

@ -307,12 +307,17 @@ void RaceResultGUI::determineTableLayout()
m_width_column_space = 20;
// Determine width of new points column
m_font->setMonospaceDigits(true);
core::dimension2du r_new_p = m_font->getDimension(L"+99");
m_width_new_points = r_new_p.Width;
// Determine width of overall points column
core::dimension2du r_all_p = m_font->getDimension(L"999");
unsigned int width_all_points = r_all_p.Width;
m_font->setMonospaceDigits(false);
m_width_all_points = r_all_p.Width;
m_table_width = m_width_icon + m_width_column_space
+ m_width_kart_name;
@ -322,7 +327,7 @@ void RaceResultGUI::determineTableLayout()
// Only in GP mode are the points displayed.
if (race_manager->getMajorMode()==RaceManager::MAJOR_MODE_GRAND_PRIX)
m_table_width += m_width_new_points + width_all_points
m_table_width += m_width_new_points + m_width_all_points
+ 2 * m_width_column_space;
m_leftmost_column = table_area->m_x + (table_area->m_w - m_table_width)/2;
@ -640,26 +645,11 @@ void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y,
current_x += m_width_finish_time + m_width_column_space;
}
if (m_highscore_player != NULL && ri->m_player == m_highscore_player)
{
current_x += 20;
core::recti dest_rect = core::recti(current_x, y, current_x+100, y+10);
core::stringw message = (m_highscore_rank == 1 ? _("You topped the highscore list!") : _("New highscore!"));
GUIEngine::getSmallFont()->draw(message.c_str(), dest_rect, video::SColor(255,255,166,0),
false, false, NULL, true /* ignoreRTL */);
//printf("==== Highscore by %s ====\n", core::stringc(m_highscore_player->getProfile()->getName().c_str()).c_str());
}
// Only display points in GP mode and when the GP results are displayed.
// =====================================================================
if(race_manager->getMajorMode()!=RaceManager::MAJOR_MODE_GRAND_PRIX ||
m_animation_state == RR_RACE_RESULT)
return;
if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX &&
m_animation_state != RR_RACE_RESULT)
{
// Draw the new points
// -------------------
if(ri->m_new_points > 0)
@ -685,6 +675,23 @@ void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y,
point_inc_string = core::stringw(" ")+point_inc_string;
m_font->draw(point_inc_string, dest_rect, color, false, false, NULL, true /* ignoreRTL */);
current_x += m_width_all_points + m_width_column_space;
}
if (m_highscore_player != NULL && ri->m_player == m_highscore_player)
{
current_x += 20;
core::recti dest_rect = core::recti(current_x, y, current_x+100, y+10);
core::stringw message = (m_highscore_rank == 1 ? _("You topped the highscore list!") : _("New highscore!"));
GUIEngine::getSmallFont()->draw(message.c_str(), dest_rect, video::SColor(255,255,166,0),
false, false, NULL, true /* ignoreRTL */);
//printf("==== Highscore by %s ====\n", core::stringc(m_highscore_player->getProfile()->getName().c_str()).c_str());
}
} // displayOneEntry
//-----------------------------------------------------------------------------

View File

@ -177,6 +177,8 @@ private:
/** For highscores */
int m_highscore_time;
unsigned int m_width_all_points;
void displayOneEntry(unsigned int x, unsigned int y,
unsigned int n, bool display_points);
void determineTableLayout();