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

Describes a unit's animation sequence. More...

#include <frame.hpp>

Public Member Functions

 unit_frame (const frame_builder &builder=frame_builder())
 
void redraw (const std::chrono::milliseconds &frame_time, bool on_start_time, bool in_scope_of_frame, const map_location &src, const map_location &dst, halo::handle &halo_id, halo::manager &halo_man, const frame_parameters &animation_val, const frame_parameters &engine_val) const
 
frame_parameters merge_parameters (const std::chrono::milliseconds &current_time, const frame_parameters &animation_val, const frame_parameters &engine_val=frame_parameters()) const
 This function merges the value provided by: More...
 
frame_parameters parameters (const std::chrono::milliseconds &current_time) const
 
frame_parameters end_parameters () const
 
const std::chrono::milliseconds & duration () const
 
bool does_not_change () const
 
bool need_update () const
 
std::vector< std::string > debug_strings () const
 
std::set< map_locationget_overlaped_hex (const std::chrono::milliseconds &frame_time, const map_location &src, const map_location &dst, const frame_parameters &animation_val, const frame_parameters &engine_val) const
 

Private Attributes

frame_parsed_parameters builder_
 

Detailed Description

Describes a unit's animation sequence.

Definition at line 207 of file frame.hpp.

Constructor & Destructor Documentation

◆ unit_frame()

unit_frame::unit_frame ( const frame_builder builder = frame_builder())
inline

Definition at line 211 of file frame.hpp.

Member Function Documentation

◆ debug_strings()

std::vector<std::string> unit_frame::debug_strings ( ) const
inline

Definition at line 245 of file frame.hpp.

References builder_, and frame_parsed_parameters::debug_strings().

◆ does_not_change()

bool unit_frame::does_not_change ( ) const
inline

◆ duration()

const std::chrono::milliseconds& unit_frame::duration ( ) const
inline

◆ end_parameters()

frame_parameters unit_frame::end_parameters ( ) const
inline

Definition at line 225 of file frame.hpp.

References builder_, duration(), and frame_parsed_parameters::parameters().

◆ get_overlaped_hex()

std::set< map_location > unit_frame::get_overlaped_hex ( const std::chrono::milliseconds &  frame_time,
const map_location src,
const map_location dst,
const frame_parameters animation_val,
const frame_parameters engine_val 
) const

◆ merge_parameters()

frame_parameters unit_frame::merge_parameters ( const std::chrono::milliseconds &  current_time,
const frame_parameters animation_val,
const frame_parameters engine_val = frame_parameters() 
) const

This function merges the value provided by:

  • the frame
  • the engine (poison, flying unit...)
  • the animation as a whole

There is no absolute rule for merging, so creativity is the rule. If a value is never provided by the engine, assert. This way if it becomes used, people will easily find the right place to look.

The engine provides a default image to use for the unit when none is available

The engine provides a default image to use for the unit when none is available

The engine provides a string for "petrified" and "team color" modifications. Note that image_mod is the complete modification and halo_mod is only the TC part.

The engine provides a y modification for terrain with height adjust and flying units

The engine provides a blend color for poisoned units

The engine provides a blend color for poisoned units

The engine provides a highlight ratio for selected units and visible "invisible" units

The engine provides a submerge for units in water

The engine provides a y modification for terrain with height adjust and flying units

The engine provides us with a default value to compare to. Update if different

Definition at line 917 of file frame.cpp.

References frame_parameters::auto_hflip, frame_parameters::auto_vflip, frame_parameters::blend_ratio, frame_parameters::blend_with, builder_, frame_parameters::directional_x, frame_parameters::directional_y, frame_parameters::drawing_layer, frame_parameters::duration, get_abs_frame_layer(), image::locator::get_filename(), frame_parameters::halo, frame_parameters::halo_mod, frame_parameters::halo_x, frame_parameters::halo_y, frame_parameters::highlight_ratio, frame_parameters::image, frame_parameters::image_diagonal, frame_parameters::image_mod, image::locator::is_void(), frame_parameters::offset, frame_parsed_parameters::parameters(), frame_parameters::primary_frame, frame_parameters::sound, frame_parameters::submerge, frame_parameters::text, frame_parameters::text_color, unit_default, frame_parameters::x, and frame_parameters::y.

Referenced by get_overlaped_hex(), unit_animation::particle::parameters(), and redraw().

◆ need_update()

bool unit_frame::need_update ( ) const
inline

Definition at line 240 of file frame.hpp.

References builder_, and frame_parsed_parameters::need_update().

◆ parameters()

frame_parameters unit_frame::parameters ( const std::chrono::milliseconds &  current_time) const
inline

Definition at line 220 of file frame.hpp.

References builder_, and frame_parsed_parameters::parameters().

◆ redraw()

void unit_frame::redraw ( const std::chrono::milliseconds &  frame_time,
bool  on_start_time,
bool  in_scope_of_frame,
const map_location src,
const map_location dst,
halo::handle halo_id,
halo::manager halo_man,
const frame_parameters animation_val,
const frame_parameters engine_val 
) const

Member Data Documentation

◆ builder_

frame_parsed_parameters unit_frame::builder_
private

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