The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
unit_animation Class Reference

#include <animation.hpp>

Classes

class  particule
 

Public Types

enum  variation_type { MATCH_FAIL =-10, DEFAULT_ANIM =-9 }
 
enum  hit_type { HIT, MISS, KILL, INVALID }
 

Public Member Functions

int matches (const display &disp, const map_location &loc, const map_location &second_loc, const unit *my_unit, const std::string &event="", const int value=0, hit_type hit=INVALID, const attack_type *attack=nullptr, const attack_type *second_attack=nullptr, int value2=0) const
 
const unit_frameget_last_frame () const
 
void add_frame (int duration, const unit_frame &value, bool force_change=false)
 
bool need_update () const
 
bool need_minimal_update () const
 
bool animation_finished () const
 
bool animation_finished_potential () const
 
void update_last_draw_time ()
 
int get_begin_time () const
 
int get_end_time () const
 
int time_to_tick (int animation_time) const
 
int get_animation_time () const
 
int get_animation_time_potential () const
 
void start_animation (int start_time, const map_location &src=map_location::null_location(), const map_location &dst=map_location::null_location(), const std::string &text="", const Uint32 text_color=0, const bool accelerate=true)
 
void update_parameters (const map_location &src, const map_location &dst)
 
void pause_animation ()
 
void restart_animation ()
 
int get_current_frame_begin_time () const
 
void redraw (frame_parameters &value, halo::manager &halo_man)
 
void clear_haloes ()
 
bool invalidate (frame_parameters &value)
 
std::string debug () const
 
 unit_animation (const config &cfg, const std::string &frame_string="")
 

Static Public Member Functions

static const std::vector
< std::string > & 
all_tag_names ()
 
static void fill_initial_animations (std::vector< unit_animation > &animations, const config &cfg)
 
static void add_anims (std::vector< unit_animation > &animations, const config &cfg)
 

Protected Member Functions

const frame_parameters get_current_params (const frame_parameters &default_val=frame_parameters()) const
 

Private Member Functions

 unit_animation ()
 Shouldn't be used so only declared. More...
 
 unit_animation (int start_time, const unit_frame &frame, const std::string &event="", const int variation=DEFAULT_ANIM, const frame_builder &builder=frame_builder())
 

Private Attributes

t_translation::t_list terrain_types_
 
std::vector< configunit_filter_
 
std::vector< configsecondary_unit_filter_
 
std::vector
< map_location::DIRECTION
directions_
 
int frequency_
 
int base_score_
 
std::vector< std::stringevent_
 
std::vector< intvalue_
 
std::vector< configprimary_attack_filter_
 
std::vector< configsecondary_attack_filter_
 
std::vector< hit_typehits_
 
std::vector< intvalue2_
 
std::map< std::string, particulesub_anims_
 
particule unit_anim_
 
map_location src_
 
map_location dst_
 
bool invalidated_
 
bool play_offscreen_
 
std::set< map_locationoverlaped_hex_
 

Friends

class unit
 
class unit_drawer
 
std::ostream & operator<< (std::ostream &outstream, const unit_animation &u_animation)
 

Detailed Description

Definition at line 27 of file animation.hpp.

Member Enumeration Documentation

Enumerator
HIT 
MISS 
KILL 
INVALID 

Definition at line 33 of file animation.hpp.

Enumerator
MATCH_FAIL 
DEFAULT_ANIM 

Definition at line 32 of file animation.hpp.

Constructor & Destructor Documentation

unit_animation::unit_animation ( )
private

Shouldn't be used so only declared.

Referenced by add_anims(), and fill_initial_animations().

unit_animation::unit_animation ( const config cfg,
const std::string frame_string = "" 
)
explicit
unit_animation::unit_animation ( int  start_time,
const unit_frame frame,
const std::string event = "",
const int  variation = DEFAULT_ANIM,
const frame_builder builder = frame_builder() 
)
explicitprivate

Definition at line 268 of file animation.cpp.

References add_frame(), unit_frame::does_not_change(), and unit_frame::duration().

Member Function Documentation

void unit_animation::add_anims ( std::vector< unit_animation > &  animations,
const config cfg 
)
static
void unit_animation::add_frame ( int  duration,
const unit_frame value,
bool  force_change = false 
)
inline

Definition at line 43 of file animation.hpp.

References animated< T, T_void_value >::add_frame(), and unit_anim_.

Referenced by unit_animation().

const std::vector< std::string > & unit_animation::all_tag_names ( )
static

Definition at line 65 of file animation.cpp.

bool unit_animation::animation_finished ( ) const
bool unit_animation::animation_finished_potential ( ) const
void unit_animation::clear_haloes ( )

Definition at line 1040 of file animation.cpp.

References unit_animation::particule::clear_halo(), sub_anims_, and unit_anim_.

std::string unit_animation::debug ( ) const

Definition at line 1091 of file animation.cpp.

void unit_animation::fill_initial_animations ( std::vector< unit_animation > &  animations,
const config cfg 
)
static
int unit_animation::get_animation_time ( ) const
inline
int unit_animation::get_animation_time_potential ( ) const
inline
int unit_animation::get_begin_time ( ) const
int unit_animation::get_current_frame_begin_time ( ) const
inline
const frame_parameters unit_animation::get_current_params ( const frame_parameters default_val = frame_parameters()) const
inlineprotected

Definition at line 78 of file animation.hpp.

References unit_animation::particule::parameters(), and unit_anim_.

int unit_animation::get_end_time ( ) const
const unit_frame& unit_animation::get_last_frame ( ) const
inline

Definition at line 42 of file animation.hpp.

References animated< T, T_void_value >::get_last_frame(), and unit_anim_.

bool unit_animation::invalidate ( frame_parameters value)
int unit_animation::matches ( const display disp,
const map_location loc,
const map_location second_loc,
const unit my_unit,
const std::string event = "",
const int  value = 0,
hit_type  hit = INVALID,
const attack_type attack = nullptr,
const attack_type second_attack = nullptr,
int  value2 = 0 
) const
bool unit_animation::need_minimal_update ( ) const
bool unit_animation::need_update ( ) const
void unit_animation::pause_animation ( )
void unit_animation::redraw ( frame_parameters value,
halo::manager halo_man 
)
void unit_animation::restart_animation ( )
void unit_animation::start_animation ( int  start_time,
const map_location src = map_location::null_location(),
const map_location dst = map_location::null_location(),
const std::string text = "",
const Uint32  text_color = 0,
const bool  accelerate = true 
)
int unit_animation::time_to_tick ( int  animation_time) const
inline

Definition at line 52 of file animation.hpp.

References animated< T, T_void_value >::time_to_tick(), and unit_anim_.

void unit_animation::update_last_draw_time ( )
void unit_animation::update_parameters ( const map_location src,
const map_location dst 
)

Definition at line 1004 of file animation.cpp.

References dst_, and src_.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  outstream,
const unit_animation u_animation 
)
friend

Definition at line 1098 of file animation.cpp.

friend class unit
friend

Definition at line 71 of file animation.hpp.

friend class unit_drawer
friend

Definition at line 72 of file animation.hpp.

Member Data Documentation

int unit_animation::base_score_
private

Definition at line 133 of file animation.hpp.

Referenced by matches().

std::vector<map_location::DIRECTION> unit_animation::directions_
private

Definition at line 131 of file animation.hpp.

Referenced by matches(), operator<<(), and unit_animation().

map_location unit_animation::dst_
private

Definition at line 144 of file animation.hpp.

Referenced by invalidate(), redraw(), start_animation(), and update_parameters().

std::vector<std::string> unit_animation::event_
private

Definition at line 134 of file animation.hpp.

Referenced by matches(), operator<<(), and unit_animation().

int unit_animation::frequency_
private

Definition at line 132 of file animation.hpp.

Referenced by matches(), and operator<<().

std::vector<hit_type> unit_animation::hits_
private

Definition at line 138 of file animation.hpp.

Referenced by matches(), operator<<(), and unit_animation().

bool unit_animation::invalidated_
private

Definition at line 146 of file animation.hpp.

Referenced by invalidate(), and redraw().

std::set<map_location> unit_animation::overlaped_hex_
private

Definition at line 148 of file animation.hpp.

Referenced by invalidate(), and redraw().

bool unit_animation::play_offscreen_
private

Definition at line 147 of file animation.hpp.

Referenced by need_minimal_update(), and unit_animation().

std::vector<config> unit_animation::primary_attack_filter_
private

Definition at line 136 of file animation.hpp.

Referenced by matches(), operator<<(), and unit_animation().

std::vector<config> unit_animation::secondary_attack_filter_
private

Definition at line 137 of file animation.hpp.

Referenced by matches(), operator<<(), and unit_animation().

std::vector<config> unit_animation::secondary_unit_filter_
private

Definition at line 130 of file animation.hpp.

Referenced by matches(), operator<<(), and unit_animation().

map_location unit_animation::src_
private

Definition at line 143 of file animation.hpp.

Referenced by invalidate(), redraw(), start_animation(), and update_parameters().

std::map<std::string,particule> unit_animation::sub_anims_
private
t_translation::t_list unit_animation::terrain_types_
private

Definition at line 128 of file animation.hpp.

Referenced by matches(), and operator<<().

particule unit_animation::unit_anim_
private
std::vector<config> unit_animation::unit_filter_
private

Definition at line 129 of file animation.hpp.

Referenced by matches(), operator<<(), and unit_animation().

std::vector<int> unit_animation::value2_
private

Definition at line 139 of file animation.hpp.

Referenced by matches(), and unit_animation().

std::vector<int> unit_animation::value_
private

Definition at line 135 of file animation.hpp.

Referenced by matches(), and unit_animation().


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