Color the text (mainly border including title and billboard) base on current skin

This commit is contained in:
Benau 2015-11-14 01:06:28 +08:00
parent bc712b5a44
commit 962fe919d2
8 changed files with 31 additions and 20 deletions

View File

@ -257,4 +257,9 @@ when the border that intersect at this corner are enabled.
<!-- Rating star image -->
<element type="rating" state="neutral" image="ocean/rating_star.png" />
<!-- Font color -->
<color type="top" state="font" a="255" r="100" g="200" b="220" />
<color type="bottom" state="font" a="255" r="80" g="80" b="220" />
<color type="normal" state="font" a="255" r="40" g="40" b="180" />
</skin>

View File

@ -255,4 +255,9 @@ when the border that intersect at this corner are enabled.
<!-- Rating star image -->
<element type="rating" state="neutral" image="peach/rating_star.png" />
<!-- Font color -->
<color type="top" state="font" a="255" r="255" g="128" b="0" />
<color type="bottom" state="font" a="255" r="255" g="220" b="15" />
<color type="normal" state="font" a="255" r="210" g="100" b="50" />
</skin>

View File

@ -16,10 +16,10 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "guiengine/scalable_font.hpp"
#include "graphics/2dutils.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/skin.hpp"
#include "io/file_manager.hpp"
#include "utils/translation.hpp"
@ -992,10 +992,11 @@ void ScalableFont::doDraw(const core::stringw& text,
if (fallback[n] || m_type == T_BOLD)
{
// TODO: don't hardcode colors?
video::SColor orange(color.getAlpha(), 255, 100, 0);
video::SColor yellow(color.getAlpha(), 255, 220, 15);
video::SColor title_colors[] = {orange, yellow, orange, yellow};
video::SColor title_colors[] = {GUIEngine::getSkin()->getColor("top::font" ),
GUIEngine::getSkin()->getColor("bottom::font"),
GUIEngine::getSkin()->getColor("top::font" ),
GUIEngine::getSkin()->getColor("bottom::font")
};
if (charCollector != NULL)
{

View File

@ -354,9 +354,9 @@ void PlayerController::update(float dt)
if (m)
{
m->addMessage(_("Penalty time!!"), m_kart, 2.0f,
video::SColor(255, 255, 128, 0));
GUIEngine::getSkin()->getColor("top::font"));
m->addMessage(_("Don't accelerate before go"), m_kart, 2.0f,
video::SColor(255, 210, 100, 50));
GUIEngine::getSkin()->getColor("normal::font"));
}
m_bzzt_sound->play();

View File

@ -2753,8 +2753,8 @@ void Kart::setOnScreenText(const wchar_t *text)
gui::ScalableFont* font = GUIEngine::getFont() ? GUIEngine::getFont()
: GUIEngine::getTitleFont();
new STKTextBillboard(text, font,
video::SColor(255, 255, 225, 0),
video::SColor(255, 255, 89, 0),
GUIEngine::getSkin()->getColor("bottom::font"),
GUIEngine::getSkin()->getColor("top::font"),
getNode(), irr_driver->getSceneManager(), -1,
core::vector3df(0.0f, 1.5f, 0.0f),
core::vector3df(1.0f, 1.0f, 1.0f));
@ -2770,8 +2770,8 @@ void Kart::setOnScreenText(const wchar_t *text)
textsize.Height/55.0f),
core::vector3df(0.0f, 1.5f, 0.0f),
-1, // id
video::SColor(255, 255, 225, 0),
video::SColor(255, 255, 89, 0));
GUIEngine::getSkin()->getColor("bottom::font"),
GUIEngine::getSkin()->getColor("top::font"));
}
// No need to store the reference to the billboard scene node:

View File

@ -282,7 +282,7 @@ void LinearWorld::newLap(unsigned int kart_index)
if (raceHasLaps() && kart_info.m_race_lap+1 == lap_count)
{
m_race_gui->addMessage(_("Final lap!"), kart,
3.0f, video::SColor(255, 210, 100, 50), true);
3.0f, GUIEngine::getSkin()->getColor("normal::font"), true);
if(!m_last_lap_sfx_played && lap_count > 1)
{
if (UserConfigParams::m_music)
@ -309,7 +309,7 @@ void LinearWorld::newLap(unsigned int kart_index)
kart_info.m_race_lap+1 < lap_count)
{
m_race_gui->addMessage(_("Lap %i", kart_info.m_race_lap+1),
kart, 3.0f, video::SColor(255, 210, 100, 50),
kart, 3.0f, GUIEngine::getSkin()->getColor("normal::font"),
true);
}

View File

@ -98,8 +98,8 @@ namespace Scripting
{
gui::ScalableFont* font = GUIEngine::getHighresDigitFont();
STKTextBillboard* tb = new STKTextBillboard(wtext.c_str(), font,
video::SColor(255, 255, 225, 0),
video::SColor(255, 255, 89, 0),
GUIEngine::getSkin()->getColor("bottom::font"),
GUIEngine::getSkin()->getColor("top::font"),
irr_driver->getSceneManager()->getRootSceneNode(),
irr_driver->getSceneManager(), -1, xyz,
core::vector3df(1.5f, 1.5f, 1.5f));
@ -117,8 +117,8 @@ namespace Scripting
textsize.Height / 35.0f),
xyz,
-1, // id
video::SColor(255, 255, 225, 0),
video::SColor(255, 255, 89, 0));
GUIEngine::getSkin()->getColor("bottom::font"),
GUIEngine::getSkin()->getColor("top::font"));
World::getWorld()->getTrack()->addNode(sn);
}
}

View File

@ -467,7 +467,7 @@ void RaceGUIOverworld::drawGlobalMiniMap()
irr_driver->getActualScreenSize().Width,
irr_driver->getActualScreenSize().Height);
GUIEngine::getOutlineFont()->draw(_("Press fire to play the tutorial"), pos2,
video::SColor(255,255,150,60),
GUIEngine::getSkin()->getColor("normal::font"),
true, true /* vcenter */, NULL);
continue;
}
@ -537,7 +537,7 @@ void RaceGUIOverworld::drawGlobalMiniMap()
irr_driver->getActualScreenSize().Width,
irr_driver->getActualScreenSize().Height);
GUIEngine::getOutlineFont()->draw(_("Press fire to start the challenge"), pos2,
video::SColor(255,255,150,60),
GUIEngine::getSkin()->getColor("normal::font"),
true, true /* vcenter */, NULL);
}
}