Improve text legibility
This commit is contained in:
parent
196117c41e
commit
6a21ca75fb
@ -52,12 +52,16 @@ void ScalableFont::setShadow(const irr::video::SColor &col)
|
|||||||
m_font_settings->setShadow(true);
|
m_font_settings->setShadow(true);
|
||||||
m_font_settings->setShadowColor(col);
|
m_font_settings->setShadowColor(col);
|
||||||
} // setShadow
|
} // setShadow
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void ScalableFont::disableShadow()
|
void ScalableFont::disableShadow()
|
||||||
{
|
{
|
||||||
m_font_settings->setShadow(false);
|
m_font_settings->setShadow(false);
|
||||||
} // setShadow
|
} // setShadow
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
void ScalableFont::setBlackBorder(bool enabled)
|
||||||
|
{
|
||||||
|
m_font_settings->setBlackBorder(enabled);
|
||||||
|
} // setShadow
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void ScalableFont::setScale(float scale)
|
void ScalableFont::setScale(float scale)
|
||||||
|
@ -57,6 +57,8 @@ public:
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
void disableShadow();
|
void disableShadow();
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
void setBlackBorder(bool enabled);
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
void updateRTL();
|
void updateRTL();
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
void draw(const core::stringw& text, const core::rect<s32>& position,
|
void draw(const core::stringw& text, const core::rect<s32>& position,
|
||||||
|
@ -239,9 +239,11 @@ void LocalPlayerController::displayPenaltyWarning()
|
|||||||
if (m)
|
if (m)
|
||||||
{
|
{
|
||||||
m->addMessage(_("Penalty time!!"), m_kart, 2.0f,
|
m->addMessage(_("Penalty time!!"), m_kart, 2.0f,
|
||||||
GUIEngine::getSkin()->getColor("font::top"));
|
GUIEngine::getSkin()->getColor("font::top"), true /* important */,
|
||||||
|
false /* big font */, true /* outline */);
|
||||||
m->addMessage(_("Don't accelerate before go"), m_kart, 2.0f,
|
m->addMessage(_("Don't accelerate before go"), m_kart, 2.0f,
|
||||||
GUIEngine::getSkin()->getColor("font::normal"));
|
GUIEngine::getSkin()->getColor("font::normal"), true /* important */,
|
||||||
|
false /* big font */, true /* outline */);
|
||||||
}
|
}
|
||||||
m_kart->playSound(m_bzzt_sound);
|
m_kart->playSound(m_bzzt_sound);
|
||||||
} // displayPenaltyWarning
|
} // displayPenaltyWarning
|
||||||
|
@ -225,9 +225,19 @@ void RaceGUIBase::drawAllMessages(const AbstractKart* kart,
|
|||||||
if (msg.m_kart && msg.m_kart!=kart) continue;
|
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);
|
core::rect<s32> pos(x - w/2, y, x + w/2, y + m_max_font_height);
|
||||||
GUIEngine::getSmallFont()->draw(
|
|
||||||
|
gui::ScalableFont* font = GUIEngine::getSmallFont();
|
||||||
|
|
||||||
|
if (msg.m_outline)
|
||||||
|
font->setBlackBorder(true);
|
||||||
|
|
||||||
|
font->draw(
|
||||||
core::stringw(msg.m_message.c_str()).c_str(),
|
core::stringw(msg.m_message.c_str()).c_str(),
|
||||||
pos, msg.m_color, true /* hcenter */, true /* vcenter */);
|
pos, msg.m_color, true /* hcenter */, true /* vcenter */);
|
||||||
|
|
||||||
|
if (msg.m_outline)
|
||||||
|
font->setBlackBorder(false);
|
||||||
|
|
||||||
y -= m_small_font_max_height;
|
y -= m_small_font_max_height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -273,9 +283,16 @@ void RaceGUIBase::drawAllMessages(const AbstractKart* kart,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (msg.m_outline)
|
||||||
|
font->setBlackBorder(true);
|
||||||
|
|
||||||
font->draw(core::stringw(msg.m_message.c_str()).c_str(),
|
font->draw(core::stringw(msg.m_message.c_str()).c_str(),
|
||||||
pos, msg.m_color, true /* hcenter */,
|
pos, msg.m_color, true /* hcenter */,
|
||||||
true /* vcenter */);
|
true /* vcenter */);
|
||||||
|
|
||||||
|
if (msg.m_outline)
|
||||||
|
font->setBlackBorder(false);
|
||||||
|
|
||||||
y += font_height;
|
y += font_height;
|
||||||
}
|
}
|
||||||
} // for i in all messages
|
} // for i in all messages
|
||||||
@ -460,9 +477,9 @@ void RaceGUIBase::renderPlayerView(const Camera *camera, float dt)
|
|||||||
void RaceGUIBase::addMessage(const core::stringw &msg,
|
void RaceGUIBase::addMessage(const core::stringw &msg,
|
||||||
const AbstractKart *kart,
|
const AbstractKart *kart,
|
||||||
float time, const video::SColor &color,
|
float time, const video::SColor &color,
|
||||||
bool important, bool big_font)
|
bool important, bool big_font, bool outline)
|
||||||
{
|
{
|
||||||
m_messages.push_back(TimedMessage(msg, kart, time, color, important, big_font));
|
m_messages.push_back(TimedMessage(msg, kart, time, color, important, big_font, outline));
|
||||||
} // addMessage
|
} // addMessage
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -88,6 +88,8 @@ private:
|
|||||||
bool m_important;
|
bool m_important;
|
||||||
bool m_big_font;
|
bool m_big_font;
|
||||||
|
|
||||||
|
bool m_outline;
|
||||||
|
|
||||||
// -----------------------------------------------------
|
// -----------------------------------------------------
|
||||||
// std::vector needs standard copy-ctor and std-assignment op.
|
// std::vector needs standard copy-ctor and std-assignment op.
|
||||||
// let compiler create defaults .. they'll do the job, no
|
// let compiler create defaults .. they'll do the job, no
|
||||||
@ -95,7 +97,7 @@ private:
|
|||||||
TimedMessage(const irr::core::stringw &message,
|
TimedMessage(const irr::core::stringw &message,
|
||||||
const AbstractKart *kart, float time,
|
const AbstractKart *kart, float time,
|
||||||
const video::SColor &color, const bool important,
|
const video::SColor &color, const bool important,
|
||||||
bool big_font)
|
bool big_font, bool outline)
|
||||||
{
|
{
|
||||||
m_message = message;
|
m_message = message;
|
||||||
m_kart = kart;
|
m_kart = kart;
|
||||||
@ -103,6 +105,7 @@ private:
|
|||||||
m_color = color;
|
m_color = color;
|
||||||
m_important = important;
|
m_important = important;
|
||||||
m_big_font = big_font;
|
m_big_font = big_font;
|
||||||
|
m_outline = outline;
|
||||||
} // TimedMessage
|
} // TimedMessage
|
||||||
// -----------------------------------------------------
|
// -----------------------------------------------------
|
||||||
// in follow leader the clock counts backwards
|
// in follow leader the clock counts backwards
|
||||||
@ -229,7 +232,7 @@ public:
|
|||||||
const video::SColor &color=
|
const video::SColor &color=
|
||||||
video::SColor(255, 255, 0, 255),
|
video::SColor(255, 255, 0, 255),
|
||||||
bool important=true,
|
bool important=true,
|
||||||
bool big_font=false);
|
bool big_font=false, bool outline=false);
|
||||||
virtual void update(float dt);
|
virtual void update(float dt);
|
||||||
virtual void preRenderCallback(const Camera *camera);
|
virtual void preRenderCallback(const Camera *camera);
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
@ -237,7 +237,8 @@ public:
|
|||||||
const video::SColor &color=
|
const video::SColor &color=
|
||||||
video::SColor(255, 255, 0, 255),
|
video::SColor(255, 255, 0, 255),
|
||||||
bool important=true,
|
bool important=true,
|
||||||
bool big_font=false) OVERRIDE { }
|
bool big_font=false,
|
||||||
|
bool outline=false) OVERRIDE { }
|
||||||
|
|
||||||
void nextPhase();
|
void nextPhase();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user