Improved vertical spacing betweewn messages to adapt to font (but multi-line messages are NOT supported anymore)
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4931 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
c18ba6bc03
commit
d0624a7ab7
@ -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);
|
||||
}
|
||||
|
@ -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<s32> pos(x - w/2, y, x + w/2, y + MESSAGE_MAX_HEIGHT);
|
||||
core::rect<s32> 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
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user