Display less important messages in white, at the bottom of the screen, to not detract attention from gaming. Fixed probable grammar mistake in string
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4950 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
2827533e70
commit
11c147c8e9
@ -710,10 +710,11 @@ void IrrDriver::displayFPS()
|
||||
{
|
||||
// We will let pass some time to let things settle before trusting FPS counter
|
||||
// even if we also ignore fps = 1, which tends to happen in first checks
|
||||
#define NO_TRUST_COUNT 25
|
||||
const int NO_TRUST_COUNT = 25;
|
||||
static int no_trust = NO_TRUST_COUNT;
|
||||
|
||||
if(no_trust) {
|
||||
if (no_trust)
|
||||
{
|
||||
no_trust--;
|
||||
return;
|
||||
}
|
||||
@ -745,7 +746,7 @@ void IrrDriver::displayFPS()
|
||||
core::stringw fpsString = buffer;
|
||||
|
||||
static video::SColor fpsColor = video::SColor(255, 255, 0, 0);
|
||||
font->draw( fpsString.c_str(), core::rect< s32 >(0,0,600,200), fpsColor, true );
|
||||
font->draw( fpsString.c_str(), core::rect< s32 >(100,0,400,50), fpsColor, false );
|
||||
} // updateFPS
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -326,7 +326,7 @@ void Flyable::hit(Kart *kart_hit, PhysicalObject* object)
|
||||
irr::core::stringw hit_message;
|
||||
switch(m_type) {
|
||||
case POWERUP_CAKE:
|
||||
hit_message += StringUtils::insertValues(_("%s eats too much %s's cake"),
|
||||
hit_message += StringUtils::insertValues(_("%s eats too much of %s's cake"),
|
||||
kart_hit->getName().c_str(),
|
||||
m_owner->getName().c_str()
|
||||
).c_str();
|
||||
@ -340,9 +340,9 @@ void Flyable::hit(Kart *kart_hit, PhysicalObject* object)
|
||||
).c_str();
|
||||
break;
|
||||
default:
|
||||
hit_message = _("UFO hit someone, the bug is right here");
|
||||
assert(false);
|
||||
}
|
||||
gui->addMessage(hit_message, NULL, 3.0f, 40, video::SColor(255, 210, 50, 50));
|
||||
gui->addMessage(hit_message, NULL, 3.0f, 40, video::SColor(255, 255, 255, 255), false);
|
||||
}
|
||||
|
||||
m_has_hit_something=true;
|
||||
|
@ -162,7 +162,7 @@ void Plunger::hit(Kart *kart, PhysicalObject *obj)
|
||||
kart->getName().c_str(),
|
||||
m_owner->getName().c_str()
|
||||
).c_str();
|
||||
gui->addMessage(hit_message, NULL, 3.0f, 40, video::SColor(255, 210, 50, 50));
|
||||
gui->addMessage(hit_message, NULL, 3.0f, 40, video::SColor(255, 255, 255, 255), false);
|
||||
}
|
||||
|
||||
m_keep_alive = 0;
|
||||
|
@ -146,7 +146,8 @@ void Powerup::use()
|
||||
m_sound_use->position(m_owner->getXYZ());
|
||||
m_sound_use->play();
|
||||
// Apocalypse Now style
|
||||
gui->addMessage(_("Magic, son. Nothing else in the world smells like that."), NULL, 3.0f, 40, video::SColor(255, 210, 50, 50));
|
||||
gui->addMessage(_("Magic, son. Nothing else in the world smells like that."), NULL, 3.0f, 40,
|
||||
video::SColor(255, 255, 255, 255), false);
|
||||
break;
|
||||
case POWERUP_CAKE:
|
||||
case POWERUP_BOWLING:
|
||||
@ -203,7 +204,7 @@ void Powerup::use()
|
||||
|
||||
irr::core::stringw anchor_message;
|
||||
anchor_message += StringUtils::insertValues(_("Arrr, the %s dropped anchor, Captain!"), kart->getName().c_str()).c_str();
|
||||
gui->addMessage(anchor_message, NULL, 3.0f, 40, video::SColor(255, 210, 50, 50));
|
||||
gui->addMessage(anchor_message, NULL, 3.0f, 40, video::SColor(255, 255, 255, 255), false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -240,7 +241,7 @@ void Powerup::use()
|
||||
m_sound_use->play();
|
||||
|
||||
// Parachutist shout
|
||||
gui->addMessage(_("Geronimo!!!"), NULL, 3.0f, 40, video::SColor(255, 210, 50, 50));
|
||||
gui->addMessage(_("Geronimo!!!"), NULL, 3.0f, 40, video::SColor(255, 255, 255, 255), false);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -219,7 +219,7 @@ void RubberBand::hit(Kart *kart_hit, const Vec3 *track_xyz)
|
||||
kart_hit->getName().c_str(),
|
||||
m_owner.getName().c_str()
|
||||
).c_str();
|
||||
gui->addMessage(hit_message, NULL, 3.0f, 40, video::SColor(255, 210, 50, 50));
|
||||
gui->addMessage(hit_message, NULL, 3.0f, 40, video::SColor(255, 255, 255, 255), false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ void LinearWorld::newLap(unsigned int kart_index)
|
||||
if(kart_info.m_race_lap+1 == race_manager->getNumLaps())
|
||||
{
|
||||
m_race_gui->addMessage(_("Final lap!"), m_karts[kart_index],
|
||||
3.0f, 40, video::SColor(255, 210, 100, 50));
|
||||
3.0f, 40, video::SColor(255, 210, 100, 50), true);
|
||||
}
|
||||
// Race finished
|
||||
if(kart_info.m_race_lap >= race_manager->getNumLaps() && raceHasLaps())
|
||||
@ -259,7 +259,7 @@ void LinearWorld::newLap(unsigned int kart_index)
|
||||
{
|
||||
setFastestLap(kart, time_per_lap);
|
||||
m_race_gui->addMessage(_("New fastest lap"), NULL,
|
||||
2.0f, 40, video::SColor(255, 100, 210, 100));
|
||||
2.0f, 40, video::SColor(255, 100, 210, 100), true);
|
||||
std::string s = StringUtils::timeToString(time_per_lap);
|
||||
|
||||
irr::core::stringw m_fastest_lap_message;
|
||||
|
@ -411,6 +411,7 @@ void RaceGUI::drawPowerupIcons(const Kart* kart,
|
||||
if(n>5) n=5; // Display at most 5 items
|
||||
|
||||
int nSize=(int)(64.0f*std::min(scaling.X, scaling.Y));
|
||||
|
||||
int x1 = (int)((UserConfigParams::m_width/2-32) * scaling.X)
|
||||
+ viewport.UpperLeftCorner.X;
|
||||
//int y1 = UserConfigParams::m_height - viewport.LowerRightCorner.Y
|
||||
@ -420,7 +421,7 @@ void RaceGUI::drawPowerupIcons(const Kart* kart,
|
||||
|
||||
video::ITexture *t=powerup->getIcon()->getTexture();
|
||||
core::rect<s32> rect(core::position2di(0, 0), t->getOriginalSize());
|
||||
|
||||
|
||||
for ( int i = 0 ; i < n ; i++ )
|
||||
{
|
||||
int x2=(int)(x1+i*std::min(scaling.X, scaling.Y)*30);
|
||||
@ -652,11 +653,29 @@ void RaceGUI::drawAllMessages(const Kart* kart,
|
||||
const core::recti &viewport,
|
||||
const core::vector2df &scaling)
|
||||
{
|
||||
// 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);
|
||||
int y = viewport.LowerRightCorner.Y - m_max_font_height;
|
||||
|
||||
const int x = (viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X)/2;
|
||||
const int w = (viewport.LowerRightCorner.X + viewport.UpperLeftCorner.X)/2;
|
||||
|
||||
// draw less important first, at the very top of the screen
|
||||
for (AllMessageType::const_iterator i = m_messages.begin(); i != m_messages.end(); ++i)
|
||||
{
|
||||
TimedMessage const &msg = *i;
|
||||
if (!msg.m_important)
|
||||
{
|
||||
// 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 + 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 -= m_max_font_height;
|
||||
}
|
||||
}
|
||||
|
||||
// First line of text somewhat under the top of the viewport.
|
||||
y = (int)(viewport.UpperLeftCorner.Y + 164*scaling.Y);
|
||||
|
||||
// The message are displayed in reverse order, so that a multi-line
|
||||
// message (addMessage("1", ...); addMessage("2",...) is displayed
|
||||
@ -665,6 +684,8 @@ void RaceGUI::drawAllMessages(const Kart* kart,
|
||||
{
|
||||
TimedMessage const &msg = *i;
|
||||
|
||||
if (!msg.m_important) continue; // less important messages were already displayed
|
||||
|
||||
// Display only messages for all karts, or messages for this kart
|
||||
if (msg.m_kart && msg.m_kart!=kart) continue;
|
||||
|
||||
@ -681,9 +702,9 @@ void RaceGUI::drawAllMessages(const Kart* kart,
|
||||
* once).
|
||||
**/
|
||||
void RaceGUI::addMessage(const core::stringw &msg, const Kart *kart, float time,
|
||||
int font_size, const video::SColor &color)
|
||||
int font_size, const video::SColor &color, bool important)
|
||||
{
|
||||
m_messages.push_back(TimedMessage(msg, kart, time, font_size, color));
|
||||
m_messages.push_back(TimedMessage(msg, kart, time, font_size, color, important));
|
||||
} // addMessage
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -61,19 +61,21 @@ private:
|
||||
video::SColor m_color; //!< color of message
|
||||
int m_font_size; //!< size
|
||||
const Kart *m_kart;
|
||||
bool m_important; //!< Important msgs are displayed in the middle of the screen
|
||||
// -----------------------------------------------------
|
||||
// std::vector needs standard copy-ctor and std-assignment op.
|
||||
// let compiler create defaults .. they'll do the job, no
|
||||
// deep copies here ..
|
||||
TimedMessage(const irr::core::stringw &message,
|
||||
const Kart *kart, float time, int size,
|
||||
const video::SColor &color)
|
||||
const video::SColor &color, const bool important)
|
||||
{
|
||||
m_message = message;
|
||||
m_font_size = size;
|
||||
m_kart = kart;
|
||||
m_remaining_time = ( time < 0.0f ) ? -1.0f : time;
|
||||
m_color = color;
|
||||
m_important = important;
|
||||
} // TimedMessage
|
||||
// -----------------------------------------------------
|
||||
// in follow leader the clock counts backwards
|
||||
@ -90,6 +92,7 @@ private:
|
||||
Material *m_plunger_face;
|
||||
typedef std::vector<TimedMessage> AllMessageType;
|
||||
AllMessageType m_messages;
|
||||
|
||||
/** A texture with all mini dots to be displayed in the minimap for all karts. */
|
||||
video::ITexture *m_marker;
|
||||
|
||||
@ -179,7 +182,8 @@ public:
|
||||
|
||||
void addMessage(const irr::core::stringw &m, const Kart *kart, float time,
|
||||
int fonst_size,
|
||||
const video::SColor &color=video::SColor(255, 255, 0, 255));
|
||||
const video::SColor &color=video::SColor(255, 255, 0, 255),
|
||||
bool important=true);
|
||||
|
||||
void clearAllMessages() { m_messages.clear(); }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user