本文整理汇总了C++中unit_type::flag_rgb方法的典型用法代码示例。如果您正苦于以下问题:C++ unit_type::flag_rgb方法的具体用法?C++ unit_type::flag_rgb怎么用?C++ unit_type::flag_rgb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unit_type
的用法示例。
在下文中一共展示了unit_type::flag_rgb方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_unit_mouse_overlay
void mouse_action_unit::set_unit_mouse_overlay(editor_display& disp, const unit_type& u)
{
std::stringstream filename;
filename << u.image() << "~RC(" << u.flag_rgb() << '>'
<< team::get_side_color_index(disp.viewing_side()) << ')';
surface image(image::get_image(filename.str()));
Uint8 alpha = 196;
//TODO don't hardcode
int size = 72;
//int size = image->w;
int zoom = static_cast<int>(size * disp.get_zoom_factor());
// Add the alpha factor and scale the image
image = scale_surface(adjust_surface_alpha(image, alpha), zoom, zoom);
disp.set_mouseover_hex_overlay(image);
}
示例2: draw_item
void unit_palette::draw_item(const unit_type& u, surface& image, std::stringstream& tooltip_text) {
std::stringstream filename;
filename << u.image() << "~RC(" << u.flag_rgb() << '>'
<< team::get_side_color_id(gui_.viewing_side()) << ')';
image = image::get_image(filename.str());
if(image == nullptr) {
tooltip_text << "IMAGE NOT FOUND\n";
ERR_ED << "image for unit type: '" << filename.str() << "' not found" << std::endl;
image = image::get_image(game_config::images::missing);
if(image == nullptr) {
ERR_ED << "Placeholder image not found" << std::endl;
return;
}
}
if(image->w != item_size_ || image->h != item_size_) {
image.assign(scale_surface(image, item_size_, item_size_));
}
tooltip_text << u.type_name();
}
示例3: set_displayed_type
void tunit_preview_pane::set_displayed_type(const unit_type& type)
{
// Sets the current type id for the profile button callback to use
current_type_ = type.id();
if(icon_type_) {
std::string mods;
if(resources::controller) {
mods = "~RC(" + type.flag_rgb() + ">" +
team::get_side_color_index(resources::controller->current_side())
+ ")";
}
mods += "~SCALE_INTO_SHARP(144,144)" + image_mods_;
icon_type_->set_label((type.icon().empty() ? type.image() : type.icon()) + mods);
}
if(label_name_) {
label_name_->set_label("<big>" + type.type_name() + "</big>");
label_name_->set_use_markup(true);
}
if(label_level_) {
std::string l_str = vgettext("Lvl $lvl", {{"lvl", std::to_string(type.level())}});
label_level_->set_label("<b>" + l_str + "</b>");
label_level_->set_use_markup(true);
}
if(icon_race_) {
icon_race_->set_label("icons/unit-groups/race_" + type.race_id() + "_30.png");
icon_race_->set_tooltip(type.race()->name(type.genders().front()));
}
if(icon_alignment_) {
const std::string& alignment_name = type.alignment().to_string();
icon_alignment_->set_label("icons/alignments/alignment_" + alignment_name + "_30.png");
icon_alignment_->set_tooltip(unit_type::alignment_description(
type.alignment(),
type.genders().front()));
}
if(tree_details_) {
std::stringstream str;
str << "<small>";
str << "<span color='#21e100'>"
<< "<b>" << _("HP: ") << "</b>" << type.hitpoints() << "</span>" << " | ";
str << "<span color='#00a0e1'>"
<< "<b>" << _("XP: ") << "</b>" << type.experience_needed() << "</span>" << " | ";
str << "<b>" << _("MP: ") << "</b>"
<< type.movement();
str << "</small>";
tree_details_->clear();
add_name_tree_node(
tree_details_->get_root_node(),
"item",
str.str()
);
// Print trait details
{
ttree_view_node* header_node = nullptr;
for(const auto& tr : type.possible_traits()) {
t_string name = tr[type.genders().front() == unit_race::FEMALE ? "female_name" : "male_name"];
if (tr["availability"] != "musthave" || name.empty()) {
continue;
}
if (header_node == nullptr) {
header_node = &add_name_tree_node(
tree_details_->get_root_node(),
"header",
"<b>" + _("Traits") + "</b>"
);
}
add_name_tree_node(
*header_node,
"item",
name
);
}
}
// Print ability details
if(!type.abilities().empty()) {
auto& header_node = add_name_tree_node(
tree_details_->get_root_node(),
"header",
"<b>" + _("Abilities") + "</b>"
);
//.........这里部分代码省略.........