Make timer in race gui resolution-independent + fixed some very fishy code along the way
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6860 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -107,11 +107,13 @@ RaceGUI::RaceGUI()
|
||||
// align those texts properly on the right side of the viewport.
|
||||
gui::ScalableFont* font = GUIEngine::getFont();
|
||||
m_rank_lap_width = font->getDimension(m_string_lap.c_str()).Width;
|
||||
int w;font->getDimension(L"99/99").Width;
|
||||
if(race_manager->getNumLaps()>9)
|
||||
|
||||
int w;
|
||||
if (race_manager->getNumLaps() > 9)
|
||||
w = font->getDimension(L"99/99").Width;
|
||||
else
|
||||
w = font->getDimension(L"9/9").Width;
|
||||
|
||||
// In some split screen configuration the energy bar might be next
|
||||
// to the lap display - so make the lap X/Y display large enough to
|
||||
// leave space for the energy bar (16 pixels) and 10 pixels of space
|
||||
@@ -122,6 +124,8 @@ RaceGUI::RaceGUI()
|
||||
if(m_rank_lap_width < w) m_rank_lap_width = w;
|
||||
|
||||
|
||||
m_timer_width = font->getDimension(L"99:99:99").Width;
|
||||
|
||||
} // RaceGUI
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -355,8 +359,8 @@ void RaceGUI::drawGlobalTimer()
|
||||
core::stringw sw(s.c_str());
|
||||
|
||||
static video::SColor time_color = video::SColor(255, 255, 255, 255);
|
||||
core::rect<s32> pos(UserConfigParams::m_width-120, 10,
|
||||
UserConfigParams::m_width, 50);
|
||||
core::rect<s32> pos(UserConfigParams::m_width - m_timer_width - 10, 10,
|
||||
UserConfigParams::m_width, 50);
|
||||
|
||||
// special case : when 3 players play, use available 4th space for such things
|
||||
if (race_manager->getNumLocalPlayers() == 3)
|
||||
|
||||
@@ -137,13 +137,18 @@ private:
|
||||
/** Used to display messages without overlapping */
|
||||
int m_max_font_height;
|
||||
int m_small_font_max_height;
|
||||
|
||||
/** Maximum string length of 'rank', 'lap', '99/99'. Used to position
|
||||
* the rank/lap text correctly close to the right border. */
|
||||
int m_rank_lap_width;
|
||||
|
||||
/** Maximum string length for the timer */
|
||||
int m_timer_width;
|
||||
|
||||
/** Distance on track to begin showing overlap in drawGlobalPlayerIcons */
|
||||
float m_dist_show_overlap;///can be zero
|
||||
float m_icons_inertia;///can be zero
|
||||
|
||||
/** previous position of icons */
|
||||
std::vector< core::vector2d<s32> > m_previous_icons_position;
|
||||
Material *m_icons_frame;
|
||||
|
||||
Reference in New Issue
Block a user