// --------------------------------------------------------------------------------------- // void draw() { ofSetColor( ofColor::white ); ofDisableAlphaBlending(); destImage.draw( 0, 0, ofGetWidth(), ofGetHeight() ); if( drawGui ) { gui.draw(); } drawStringShadowed( fontSmall, "Method " + methodNames.at(methodIndex), 5, ofGetHeight() - 25 ); drawStringShadowed( fontSmall, "Scale " + ofToString( Scale * ScaleMultiplier ), 5, ofGetHeight() - 5 ); drawStringShadowed( fontSmall, ofToString( ofGetFrameRate(), 2), ofGetWidth() - 30, ofGetHeight() - 5); }
// drawPlayerStats //--------------------------------------------------------------------------- // Purpose: //--------------------------------------------------------------------------- void RankView::drawPlayerStats( unsigned int flagHeight) { char statBuf[256]; states.clear(); for(size_t i = 0; i < PlayerInterface::getMaxPlayers(); ++i) { PlayerState* state = PlayerInterface::getPlayer(i); if(state->getStatus() != _player_state_active) { continue; } states.push_back(state); } switch(gameconfig->gametype) { case _gametype_objective: std::sort(states.begin(), states.end(), StatesSortByObjectives()); break; case _gametype_timelimit: case _gametype_fraglimit: std::sort(states.begin(), states.end(), StatesSortByFrags()); break; } unsigned int CHAR_YPIX = Surface::getFontHeight(); unsigned int entryHeight = std::max(CHAR_YPIX, flagHeight) + 2; iXY offset( 6*8, 40); iXY flagOffset(26, 40 + (int(CHAR_YPIX - flagHeight))/2); Surface * flag = 0; for(std::vector<const PlayerState*>::iterator i = states.begin(); i != states.end(); ++i) { const PlayerState* state = *i; snprintf(statBuf, sizeof(statBuf), "%-20s%5i%7i%7i%10i", state->getName().substr(0,20).c_str(), state->getKills(), state->getLosses(), state->getTotal(), state->getObjectivesHeld()); drawStringShadowed(offset.x, offset.y, statBuf, Color::white, Color::gray64); flag = ResourceManager::getFlag(state->getFlag()); drawImage( *flag, flagOffset.x, flagOffset.y ); if ( state->getID() != PlayerInterface::getLocalPlayerIndex() ) { bool meWithHim = PlayerInterface::isSingleAllied(PlayerInterface::getLocalPlayerIndex(), state->getID()); bool himWithMe = PlayerInterface::isSingleAllied(state->getID(), PlayerInterface::getLocalPlayerIndex()); if ( meWithHim && himWithMe ) { drawImage( allyImage, 4, flagOffset.y ); } else if ( meWithHim ) { drawImage( allyRequestImage, 4, flagOffset.y ); } else if ( himWithMe ) { drawImage( allyOtherImage, 4, flagOffset.y ); } else { drawImage( noAllyImage, 4, flagOffset.y ); } } offset.y += entryHeight; flagOffset.y += entryHeight; } } // end RankView::drawPlayerStats