本文整理汇总了C++中unit::xp_bar_scaling方法的典型用法代码示例。如果您正苦于以下问题:C++ unit::xp_bar_scaling方法的具体用法?C++ unit::xp_bar_scaling怎么用?C++ unit::xp_bar_scaling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unit
的用法示例。
在下文中一共展示了unit::xp_bar_scaling方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: redraw_unit
//.........这里部分代码省略.........
if (preferences::show_enemy_orb() && !u.incapacitated())
orb_img = &enemy_orb;
else
orb_img = nullptr;
} else {
if (preferences::show_allied_orb())
orb_img = &ally_orb;
else orb_img = nullptr;
}
} else {
if (preferences::show_moved_orb())
orb_img = &moved_orb;
else orb_img = nullptr;
if(playing_team == viewing_team && !u.user_end_turn()) {
if (movement_left == total_movement) {
if (preferences::show_unmoved_orb())
orb_img = &unmoved_orb;
else orb_img = nullptr;
} else if ( dc.unit_can_move(u) ) {
if (preferences::show_partial_orb())
orb_img = &partmoved_orb;
else orb_img = nullptr;
}
}
}
if (orb_img != nullptr) {
surface orb(image::get_image(*orb_img,image::SCALED_TO_ZOOM));
disp.drawing_buffer_add(display::LAYER_UNIT_BAR,
loc, xsrc + xoff, ysrc + yoff + adjusted_params.y, orb);
}
double unit_energy = 0.0;
if(max_hitpoints > 0) {
unit_energy = double(hitpoints)/double(max_hitpoints);
}
const int bar_shift = static_cast<int>(-5*zoom_factor);
const int hp_bar_height = static_cast<int>(max_hitpoints * u.hp_bar_scaling());
const fixed_t bar_alpha = (loc == mouse_hex || loc == sel_hex) ? ftofxp(1.0): ftofxp(0.8);
draw_bar(*energy_file, xsrc+xoff+bar_shift, ysrc+yoff+adjusted_params.y,
loc, hp_bar_height, unit_energy,hp_color, bar_alpha);
if(experience > 0 && can_advance) {
const double filled = double(experience)/double(max_experience);
const int xp_bar_height = static_cast<int>(max_experience * u.xp_bar_scaling() / std::max<int>(u.level(),1));
draw_bar(*energy_file, xsrc+xoff, ysrc+yoff+adjusted_params.y,
loc, xp_bar_height, filled, xp_color, bar_alpha);
}
if (can_recruit) {
surface crown(image::get_image(u.leader_crown(),image::SCALED_TO_ZOOM));
if(!crown.null()) {
//if(bar_alpha != ftofxp(1.0)) {
// crown = adjust_surface_alpha(crown, bar_alpha);
//}
disp.drawing_buffer_add(display::LAYER_UNIT_BAR,
loc, xsrc+xoff, ysrc+yoff+adjusted_params.y, crown);
}
}
for(std::vector<std::string>::const_iterator ov = u.overlays().begin(); ov != u.overlays().end(); ++ov) {
#ifdef SDL_GPU
const sdl::timage ov_img(image::get_texture(*ov, image::SCALED_TO_ZOOM));
if(!ov_img.null()) {
disp.drawing_buffer_add(display::LAYER_UNIT_BAR,
loc, xsrc, ysrc +adjusted_params.y, ov_img);
}
#else
const surface ov_img(image::get_image(*ov, image::SCALED_TO_ZOOM));
if(ov_img != nullptr) {
disp.drawing_buffer_add(display::LAYER_UNIT_BAR,
loc, xsrc+xoff, ysrc+yoff+adjusted_params.y, ov_img);
}
#endif
}
}
// Smooth unit movements from terrain of different elevation.
// Do this separately from above so that the health bar doesn't go up and down.
const t_translation::t_terrain terrain_dst = map.get_terrain(dst);
const terrain_type& terrain_dst_info = map.get_terrain_info(terrain_dst);
int height_adjust_unit = static_cast<int>((terrain_info.unit_height_adjust() * (1.0 - adjusted_params.offset) +
terrain_dst_info.unit_height_adjust() * adjusted_params.offset) *
zoom_factor);
if (is_flying && height_adjust_unit < 0) {
height_adjust_unit = 0;
}
params.y -= height_adjust_unit - height_adjust;
params.halo_y -= height_adjust_unit - height_adjust;
ac.anim_->redraw(params, halo_man);
ac.refreshing_ = false;
}