The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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, std::map< surface, SDL_Rect > &bar_rects)
 
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, size_t height, double filled, const SDL_Color &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

displaydisp
 
const display_contextdc
 
const gamemapmap
 
const std::vector< team > & teams
 
halo::managerhalo_man
 
std::map< surface, SDL_Rect > & energy_bar_rects_
 
size_t viewing_team
 
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
 
int hex_size
 
int hex_size_by_2
 

Detailed Description

Definition at line 45 of file drawer.hpp.

Constructor & Destructor Documentation

unit_drawer::unit_drawer ( display thedisp,
std::map< surface, SDL_Rect > &  bar_rects 
)

Definition at line 30 of file drawer.cpp.

Member Function Documentation

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

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

White pixels are substituted for the color of the energy.

Definition at line 458 of file drawer.cpp.

References sdl::create_rect(), energy_bar_rects_, i, itor, make_neutral_surface(), and const_surface_lock::pixels().

Referenced by draw_bar().

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

draw a unit.

Definition at line 50 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(), sdl::create_rect(), 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, 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_index(), 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(), surface::null(), 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(), display::rgb(), 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, t_true, unit::TC_image_mods(), display::team_valid(), gui2::terrain, unit::total_movement(), display_context::unit_can_move(), unit_animation_component::unit_halo_, terrain_type::unit_height_adjust(), terrain_type::unit_submerge(), preferences::unmoved_color(), unit::user_end_turn(), viewing_team, viewing_team_ref, unit::xp_bar_scaling(), unit::xp_color(), map_location::y, frame_parameters::y, and zoom_factor.

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

Member Data Documentation

const display_context& unit_drawer::dc
private

Definition at line 52 of file drawer.hpp.

Referenced by redraw_unit().

display& unit_drawer::disp
private

Definition at line 51 of file drawer.hpp.

Referenced by draw_bar(), and redraw_unit().

std::map<surface,SDL_Rect>& unit_drawer::energy_bar_rects_
private

Definition at line 56 of file drawer.hpp.

Referenced by calculate_energy_bar().

halo::manager& unit_drawer::halo_man
private

Definition at line 55 of file drawer.hpp.

Referenced by redraw_unit().

int unit_drawer::hex_size
private

Definition at line 67 of file drawer.hpp.

Referenced by redraw_unit().

int unit_drawer::hex_size_by_2
private

Definition at line 68 of file drawer.hpp.

Referenced by redraw_unit().

bool unit_drawer::is_blindfolded
private

Definition at line 61 of file drawer.hpp.

Referenced by redraw_unit().

const gamemap& unit_drawer::map
private

Definition at line 53 of file drawer.hpp.

Referenced by redraw_unit().

map_location unit_drawer::mouse_hex
private

Definition at line 64 of file drawer.hpp.

Referenced by redraw_unit().

size_t unit_drawer::playing_team
private

Definition at line 58 of file drawer.hpp.

Referenced by redraw_unit().

const team& unit_drawer::playing_team_ref
private

Definition at line 60 of file drawer.hpp.

map_location unit_drawer::sel_hex
private

Definition at line 63 of file drawer.hpp.

Referenced by redraw_unit().

bool unit_drawer::show_everything
private

Definition at line 62 of file drawer.hpp.

Referenced by redraw_unit().

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

Definition at line 54 of file drawer.hpp.

size_t unit_drawer::viewing_team
private

Definition at line 57 of file drawer.hpp.

Referenced by redraw_unit().

const team& unit_drawer::viewing_team_ref
private

Definition at line 59 of file drawer.hpp.

Referenced by redraw_unit().

double unit_drawer::zoom_factor
private

Definition at line 65 of file drawer.hpp.

Referenced by draw_bar(), and redraw_unit().


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