Use back billboard arrow

This commit is contained in:
Benau 2016-01-18 09:48:16 +08:00
parent 51ce4c5cbd
commit 606add8605
2 changed files with 18 additions and 29 deletions

View File

@ -2807,32 +2807,13 @@ void Kart::setOnScreenText(const wchar_t *text)
// is started without splash screen (since "Loading" is shown even in this
// case). A smaller font would be better
irr::video::SColor top;
irr::video::SColor bottom;
SoccerTeam team = SOCCER_TEAM_BLUE;
SoccerWorld* sw = dynamic_cast<SoccerWorld*>(World::getWorld());
if (sw)
{
// Override color of text by kart team in soccer world
team = sw->getKartTeam(this->getWorldKartId());
top = (team == SOCCER_TEAM_RED ?
video::SColor(255, 255, 30, 200) : video::SColor(255, 100, 200, 220));
bottom = (team == SOCCER_TEAM_RED ?
video::SColor(255, 255, 100, 100) : video::SColor(255, 80, 80, 220));
}
else
{
top = GUIEngine::getSkin()->getColor("font::top");
bottom = GUIEngine::getSkin()->getColor("font::bottom");
}
if (CVS->isGLSL())
{
gui::ScalableFont* font = GUIEngine::getFont() ? GUIEngine::getFont()
: GUIEngine::getTitleFont();
new STKTextBillboard(text, font,
bottom,
top,
GUIEngine::getSkin()->getColor("font::bottom"),
GUIEngine::getSkin()->getColor("font::top"),
getNode(), irr_driver->getSceneManager(), -1,
core::vector3df(0.0f, 1.5f, 0.0f),
core::vector3df(1.0f, 1.0f, 1.0f));
@ -2848,8 +2829,8 @@ void Kart::setOnScreenText(const wchar_t *text)
textsize.Height/55.0f),
core::vector3df(0.0f, 1.5f, 0.0f),
-1, // id
bottom,
top);
GUIEngine::getSkin()->getColor("font::bottom"),
GUIEngine::getSkin()->getColor("font::top"));
}
// No need to store the reference to the billboard scene node:

View File

@ -272,15 +272,23 @@ void SoccerWorld::initKartList()
{
const unsigned int kart_amount = (unsigned int)m_karts.size();
// Assigning billboard text on the karts
//Loading the indicator textures
irr::video::ITexture *red =
irr_driver->getTexture(FileManager::GUI, "soccer_player_red.png");
irr::video::ITexture *blue =
irr_driver->getTexture(FileManager::GUI, "soccer_player_blue.png");
//Assigning indicators
for(unsigned int i=0; i<kart_amount; i++)
{
int human_player_id = i - (kart_amount - race_manager->getNumPlayers());
stringw name = (human_player_id >= 0 ? race_manager
->getKartInfo(human_player_id).getPlayerName() :
translations->fribidize(m_karts[i]->getName()));
scene::ISceneNode *arrowNode;
float arrow_pos_height = m_karts[i]->getKartModel()->getHeight()+0.5f;
SoccerTeam team = getKartTeam(i);
m_karts[i]->setOnScreenText(name.c_str());
arrowNode = irr_driver->addBillboard(core::dimension2d<irr::f32>(0.3f,0.3f),
team == SOCCER_TEAM_BLUE ? blue : red, m_karts[i]->getNode(), true);
arrowNode->setPosition(core::vector3df(0, arrow_pos_height, 0));
}
} // initKartList