void BuildingIndicator::Refresh() { if (!s_scanline_shader && GetOptionsDB().Get<bool>("UI.system-fog-of-war")) { boost::filesystem::path shader_path = GetRootDataDir() / "default" / "shaders" / "scanlines.frag"; std::string shader_text; ReadFile(shader_path, shader_text); s_scanline_shader = boost::shared_ptr<ShaderProgram>( ShaderProgram::shaderProgramFactory("", shader_text)); } SetBrowseModeTime(GetOptionsDB().Get<int>("UI.tooltip-delay")); TemporaryPtr<const Building> building = GetBuilding(m_building_id); if (!building) return; ClearBrowseInfoWnd(); if (m_graphic) { delete m_graphic; m_graphic = 0; } if (m_scrap_indicator) { delete m_scrap_indicator; m_scrap_indicator = 0; } if (const BuildingType* type = GetBuildingType(building->BuildingTypeName())) { boost::shared_ptr<GG::Texture> texture = ClientUI::BuildingIcon(type->Name()); m_graphic = new GG::StaticGraphic(texture, GG::GRAPHIC_FITGRAPHIC | GG::GRAPHIC_PROPSCALE); AttachChild(m_graphic); std::string desc = UserString(type->Description()); if (building->GetMeter(METER_STEALTH)) desc = UserString("METER_STEALTH") + boost::io::str(boost::format(": %3.1f\n\n") % building->GetMeter(METER_STEALTH)->Current()) + desc; if (GetOptionsDB().Get<bool>("UI.autogenerated-effects-descriptions") && !type->Effects().empty()) desc += boost::io::str(FlexibleFormat(UserString("ENC_EFFECTS_STR")) % AutoGeneratedDescription(type->Effects())); SetBrowseInfoWnd(boost::shared_ptr<GG::BrowseInfoWnd>( new IconTextBrowseWnd(texture, UserString(type->Name()), desc))); } if (building && building->OrderedScrapped()) { boost::shared_ptr<GG::Texture> scrap_texture = ClientUI::GetTexture(ClientUI::ArtDir() / "misc" / "scrapped.png", true); m_scrap_indicator = new GG::StaticGraphic(scrap_texture, GG::GRAPHIC_FITGRAPHIC | GG::GRAPHIC_PROPSCALE); AttachChild(m_scrap_indicator); } DoLayout(); }
ParticipantBar(const ParticipantSummary& participant, const BarSizer& sizer): GG::Wnd(GG::X0, GG::Y0, GG::X1, GG::Y1, GG::INTERACTIVE), m_participant(participant), m_sizer(sizer), m_hovered(false) { TemporaryPtr<UniverseObject> object = Objects().Object(participant.object_id); if(object) { SetBrowseText(object->PublicName(ClientApp::GetApp()->EmpireID()) + " " + boost::lexical_cast<std::string>(participant.current_health) + "/" + boost::lexical_cast<std::string>(participant.max_health) ); } SetBrowseModeTime(300); OptionsDB& options = GetOptionsDB(); m_dead_color = options.Get<StreamableColor>("UI.combat.summary.dead-color").ToClr(); m_wound_color = options.Get<StreamableColor>("UI.combat.summary.wound-color").ToClr(); m_health_color = options.Get<StreamableColor>("UI.combat.summary.health-color").ToClr(); }