MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / updateTeamTexture

Method updateTeamTexture

src/bzflag/JoinMenu.cpp:282–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280}
281
282void JoinMenu::updateTeamTexture() {
283 TextureManager& tm = TextureManager::instance();
284 FontManager& fm = FontManager::instance();
285
286 // load the appropriate texture
287 std::string texture;
288 if (getTeam() == AutomaticTeam) {
289 texture = "automatic_";
290 }
291 else {
292 texture = Team::getImagePrefix(getTeam());
293 }
294 texture += "icon";
295 int id = tm.getTextureID(texture);
296 teamIcon->setTexture(id);
297
298 // leave the icon the same size as the text so it doesn't overlap other lines
299 const float iconSize = team->getFontSize();
300 teamIcon->setSize(iconSize, iconSize);
301
302 // put it at the end of the text
303 Bundle* bdl = BundleMgr::getCurrentBundle();
304 const float x = team->getX() + fm.getStringWidth(team->getFontFace()->getFMFace(),
305 team->getFontSize(),
306 std::string(bdl->getLocalString(team->getList()[team->getIndex()]) + "x"));
307 teamIcon->setPosition(x, team->getY());
308}
309
310void JoinMenu::resize(int _width, int _height) {
311 HUDDialog::resize(_width, _height);

Callers 1

teamCallbackMethod · 0.80

Calls 13

getStringWidthMethod · 0.80
getFMFaceMethod · 0.80
getLocalStringMethod · 0.80
getTextureIDMethod · 0.45
setTextureMethod · 0.45
getFontSizeMethod · 0.45
setSizeMethod · 0.45
getXMethod · 0.45
getFontFaceMethod · 0.45
getListMethod · 0.45
getIndexMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected