diff --git a/src/modes/world.cpp b/src/modes/world.cpp index 0da521ce1..527845525 100644 --- a/src/modes/world.cpp +++ b/src/modes/world.cpp @@ -582,11 +582,11 @@ void World::removeKart(int kart_number, bool notifyOfElimination) if(!(*i)->getCamera()) continue; if(*i==kart) { - m_race_gui->addMessage(_("You have been\neliminated!"), *i, 2.0f, 60); + m_race_gui->addMessage(_("You have been eliminated!"), *i, 2.0f, 60); } else { - m_race_gui->addMessage(StringUtils::insertValues(_("'%s' has\nbeen eliminated."), + m_race_gui->addMessage(StringUtils::insertValues(_("'%s' has been eliminated."), kart->getName().c_str()), *i, 2.0f, 60); } diff --git a/src/states_screens/race_gui.cpp b/src/states_screens/race_gui.cpp index ba7d5497b..f1b89d757 100644 --- a/src/states_screens/race_gui.cpp +++ b/src/states_screens/race_gui.cpp @@ -56,7 +56,8 @@ RaceGUI::RaceGUI() m_map_height = 100; m_map_left = 10; m_map_bottom = 10; - + m_max_font_height = GUIEngine::getFontHeight() + 10; + // special case : when 3 players play, use available 4th space for such things if (race_manager->getNumLocalPlayers() == 3) { @@ -650,10 +651,7 @@ void RaceGUI::cleanupMessages(const float dt) void RaceGUI::drawAllMessages(const Kart* kart, const core::recti &viewport, const core::vector2df &scaling) -{ - //TODO: don't hardcode, detect dynamically from font size - const int MESSAGE_MAX_HEIGHT = 70; - +{ // First line of text somewhat under the top of the screen. For now // start just under the timer display int y = (int)(viewport.UpperLeftCorner.Y + 164*scaling.Y); @@ -670,10 +668,10 @@ void RaceGUI::drawAllMessages(const Kart* kart, // Display only messages for all karts, or messages for this kart if (msg.m_kart && msg.m_kart!=kart) continue; - core::rect pos(x - w/2, y, x + w/2, y + MESSAGE_MAX_HEIGHT); + core::rect pos(x - w/2, y, x + w/2, y + m_max_font_height); GUIEngine::getFont()->draw(core::stringw(msg.m_message.c_str()).c_str(), pos, msg.m_color, true /* hcenter */, true /* vcenter */); - y += MESSAGE_MAX_HEIGHT; + y += m_max_font_height; } // for i in all messages } // drawAllMessages diff --git a/src/states_screens/race_gui.hpp b/src/states_screens/race_gui.hpp index 14dbaf72c..3933c00bb 100644 --- a/src/states_screens/race_gui.hpp +++ b/src/states_screens/race_gui.hpp @@ -138,6 +138,9 @@ private: /** Distance of map from bottom of screen. */ int m_map_bottom; + /** Used to display messages without overlapping */ + int m_max_font_height; + void createMarkerTexture(); void createRegularPolygon(unsigned int n, float radius, const core::vector2df ¢er, @@ -166,6 +169,7 @@ private: void drawGlobalMusicDescription(); void cleanupMessages (const float dt); void drawGlobalReadySetGo (); + public: RaceGUI();