The Battle for Wesnoth  1.15.2+dev
Public Member Functions | Private Member Functions | Private Attributes | List of all members
unit_drawer Class Reference

#include <drawer.hpp>

Public Member Functions

 unit_drawer (display &thedisp)
void redraw_unit (const unit &u) const
 draw a unit. More...

Private Member Functions

void draw_bar (const std::string &image, int xpos, int ypos, const map_location &loc, std::size_t height, double filled, const color_t &col, fixed_t alpha) const
 draw a health/xp bar of a unit More...
const SDL_Rect & calculate_energy_bar (surface surf) const
 Finds the start and end rows on the energy bar image. More...

Private Attributes

const display_contextdc
const gamemapmap
const std::vector< team > & teams
std::size_t viewing_team
std::size_t playing_team
const teamviewing_team_ref
const teamplaying_team_ref
bool is_blindfolded
bool show_everything
map_location sel_hex
map_location mouse_hex
double zoom_factor
std::set< map_locationunits_that_can_reach_goal
int hex_size
int hex_size_by_2

Detailed Description

Definition at line 43 of file drawer.hpp.

Constructor & Destructor Documentation

◆ unit_drawer()

unit_drawer::unit_drawer ( display thedisp)

Member Function Documentation

◆ calculate_energy_bar()

const SDL_Rect & unit_drawer::calculate_energy_bar ( surface  surf) const

Finds the start and end rows on the energy bar image.

White pixels are substituted for the color of the energy.

Definition at line 432 of file drawer.cpp.

References i, and surface_locker< T >::pixels().

Referenced by draw_bar().

◆ draw_bar()

void unit_drawer::draw_bar ( const std::string &  image,
int  xpos,
int  ypos,
const map_location loc,
std::size_t  height,
double  filled,
const color_t col,
fixed_t  alpha 
) const

◆ redraw_unit()

void unit_drawer::redraw_unit ( const unit u) const

draw a unit.

Definition at line 59 of file drawer.cpp.

References halo::manager::add(), preferences::allied_color(), unit_animation_component::anim_, unit::anim_comp(), frame_parameters::blend_ratio, frame_parameters::blend_with, unit::can_advance(), unit::can_recruit(), unit_animation_component::clear_haloes(), dc, unit::default_anim_image(), disp, draw_bar(), unit_animation_component::draw_bars_, display::drawing_buffer_add(), unit::emits_zoc(), preferences::enemy_color(), game_config::images::energy, unit::experience(), unit::facing(), ftofxp, unit_type::get_cfg(), map_location::get_direction(), unit::get_hidden(), image::get_image(), unit::get_location(), display::get_location_x(), display::get_location_y(), team::get_side_color_id(), gamemap::get_terrain(), gamemap::get_terrain_info(), halo_man, frame_parameters::halo_mod, frame_parameters::halo_y, hex_size, hex_size_by_2, frame_parameters::highlight_ratio, unit::hitpoints(), unit::hp_bar_scaling(), unit::hp_color(), frame_parameters::image, unit::image_ellipse(), unit::image_halo(), frame_parameters::image_mod, unit::image_mods(), unit::incapacitated(), unit::invisible(), is_blindfolded, team::is_enemy(), unit::is_flying(), unit::is_visible_to_team(), display::LAYER_UNIT_BAR, display::LAYER_UNIT_FIRST, unit::leader_crown(), unit::level(), map, display::map_outside_area(), unit::max_experience(), unit::max_hitpoints(), mouse_hex, preferences::moved_color(), unit::movement_left(), game_config::images::orb, unit::overlays(), preferences::partial_color(), playing_team, unit::poisoned(), frame_parameters::primary_frame, sdl::rects_overlap(), unit_animation_component::refreshing_, halo::manager::remove(), image::SCALED_TO_ZOOM, sel_hex, game_config::images::selected, halo::manager::set_location(), unit_animation_component::set_standing(), preferences::show_allied_orb(), preferences::show_enemy_orb(), show_everything, preferences::show_moved_orb(), preferences::show_partial_orb(), preferences::show_side_colors(), preferences::show_unmoved_orb(), unit::side(), unit::slowed(), frame_parameters::submerge, unit::TC_image_mods(), display::team_valid(), gui2::terrain, unit::total_movement(), unit::type(), display_context::unit_can_move(), unit_animation_component::unit_halo_, terrain_type::unit_height_adjust(), terrain_type::unit_submerge(), units_that_can_reach_goal, preferences::unmoved_color(), unit::user_end_turn(), viewing_team, viewing_team_ref, unit::xp_bar_scaling(), unit::xp_color(), frame_parameters::y, map_location::y, and zoom_factor.

Referenced by game_display::draw_invalidated(), and display::draw_invalidated().

Member Data Documentation

◆ dc

const display_context& unit_drawer::dc

Definition at line 50 of file drawer.hpp.

Referenced by redraw_unit().

◆ disp

display& unit_drawer::disp

Definition at line 49 of file drawer.hpp.

Referenced by draw_bar(), redraw_unit(), and unit_drawer().

◆ halo_man

halo::manager& unit_drawer::halo_man

Definition at line 53 of file drawer.hpp.

Referenced by redraw_unit().

◆ hex_size

int unit_drawer::hex_size

Definition at line 65 of file drawer.hpp.

Referenced by redraw_unit().

◆ hex_size_by_2

int unit_drawer::hex_size_by_2

Definition at line 66 of file drawer.hpp.

Referenced by redraw_unit().

◆ is_blindfolded

bool unit_drawer::is_blindfolded

Definition at line 58 of file drawer.hpp.

Referenced by redraw_unit().

◆ map

const gamemap& unit_drawer::map

Definition at line 51 of file drawer.hpp.

Referenced by redraw_unit().

◆ mouse_hex

map_location unit_drawer::mouse_hex

Definition at line 61 of file drawer.hpp.

Referenced by redraw_unit().

◆ playing_team

std::size_t unit_drawer::playing_team

Definition at line 55 of file drawer.hpp.

Referenced by redraw_unit().

◆ playing_team_ref

const team& unit_drawer::playing_team_ref

Definition at line 57 of file drawer.hpp.

◆ sel_hex

map_location unit_drawer::sel_hex

Definition at line 60 of file drawer.hpp.

Referenced by redraw_unit().

◆ show_everything

bool unit_drawer::show_everything

Definition at line 59 of file drawer.hpp.

Referenced by redraw_unit().

◆ teams

const std::vector<team>& unit_drawer::teams

Definition at line 52 of file drawer.hpp.

◆ units_that_can_reach_goal

std::set<map_location> unit_drawer::units_that_can_reach_goal

Definition at line 63 of file drawer.hpp.

Referenced by redraw_unit(), and unit_drawer().

◆ viewing_team

std::size_t unit_drawer::viewing_team

Definition at line 54 of file drawer.hpp.

Referenced by redraw_unit().

◆ viewing_team_ref

const team& unit_drawer::viewing_team_ref

Definition at line 56 of file drawer.hpp.

Referenced by redraw_unit().

◆ zoom_factor

double unit_drawer::zoom_factor

Definition at line 62 of file drawer.hpp.

Referenced by draw_bar(), and redraw_unit().

The documentation for this class was generated from the following files: