本文整理汇总了C++中SoccerWorld::getNumKarts方法的典型用法代码示例。如果您正苦于以下问题:C++ SoccerWorld::getNumKarts方法的具体用法?C++ SoccerWorld::getNumKarts怎么用?C++ SoccerWorld::getNumKarts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoccerWorld
的用法示例。
在下文中一共展示了SoccerWorld::getNumKarts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawScores
/** Shows the current soccer result.
*/
void RaceGUI::drawScores()
{
SoccerWorld* soccerWorld = (SoccerWorld*)World::getWorld();
int offsetY = 5;
int offsetX = 5;
gui::ScalableFont* font = GUIEngine::getFont();
static video::SColor color = video::SColor(255,255,255,255);
//Draw kart icons above score(denoting teams)
irr::video::ITexture *red_team = irr_driver->getTexture(FileManager::GUI,
"soccer_ball_red.png");
irr::video::ITexture *blue_team = irr_driver->getTexture(FileManager::GUI,
"soccer_ball_blue.png");
irr::video::ITexture *team_icon;
int numLeader = 1;
for(unsigned int i=0; i<soccerWorld->getNumKarts(); i++)
{
int j = soccerWorld->getTeamLeader(i);
if(j < 0) break;
AbstractKart* kart = soccerWorld->getKart(i);
video::ITexture* icon = kart->getKartProperties()->getMinimapIcon();
core::rect<s32> source(core::position2di(0, 0), icon->getSize());
core::recti position(offsetX, offsetY,
offsetX + 2*m_minimap_player_size, offsetY + 2*m_minimap_player_size);
draw2DImage(icon, position, source,
NULL, NULL, true);
core::stringw score = StringUtils::toWString(soccerWorld->getScore(i));
int string_height =
GUIEngine::getFont()->getDimension(score.c_str()).Height;
core::recti pos(position.UpperLeftCorner.X + 5,
position.LowerRightCorner.Y + offsetY,
position.LowerRightCorner.X,
position.LowerRightCorner.Y + string_height);
font->draw(score.c_str(),pos,color);
switch(numLeader)
{
case 1: team_icon = red_team; break;
case 2: team_icon = blue_team; break;
default: break;
}
core::rect<s32> indicatorPos(offsetX, offsetY,
offsetX + (int)(m_minimap_player_size/1.25f),
offsetY + (int)(m_minimap_player_size/1.25f));
core::rect<s32> sourceRect(core::position2d<s32>(0,0),
team_icon->getOriginalSize());
draw2DImage(team_icon,indicatorPos,sourceRect,
NULL,NULL,true);
numLeader++;
offsetX += position.LowerRightCorner.X;
}
} // drawScores