39 int value2 = 0)
const;
46 void add_frame(
const std::chrono::milliseconds& duration,
const unit_frame& value,
bool force_change =
false)
76 ,
const std::string& text =
""
77 ,
const color_t text_color = {0,0,0}
78 ,
const bool accelerate =
true);
90 std::string
debug()
const;
104 explicit unit_animation(
const std::chrono::milliseconds& start_time
106 ,
const std::string& event =
""
128 void override(
const std::chrono::milliseconds& start_time
129 ,
const std::chrono::milliseconds& duration
131 ,
const std::string& highlight =
""
132 ,
const std::string& blend_ratio =
""
133 ,
color_t blend_color = {0,0,0}
134 ,
const std::string& offset =
""
135 ,
const std::string& layer =
""
136 ,
const std::string& modifiers =
"");
164 std::vector<strike_result::type>
hits_;
183 ,
bool with_bars =
false
184 ,
const std::string& text =
""
185 ,
const color_t text_color = {0,0,0});
188 ,
const std::string& event
191 ,
const int value = 0
192 ,
bool with_bars =
false
193 ,
const std::string& text =
""
194 ,
const color_t text_color = {0,0,0}
213 ,
const std::string& event
216 ,
const int value = 0
220 ,
int value2 = 0)
const;
223 ,
const std::string& event
226 ,
const int value = 0
227 ,
bool with_bars =
false
228 ,
const std::string& text =
""
229 ,
const color_t text_color = {0,0,0}
250 void wait_until(
const std::chrono::milliseconds& animation_time)
const;
264 std::chrono::milliseconds
start_time_ = std::chrono::milliseconds::min();
Frame-based animation system with support for looping, acceleration, and time manipulation.
std::chrono::milliseconds get_time_in_current_frame() const
How far into its own duration the current frame is, clamped to [0, duration].
std::chrono::milliseconds get_begin_time() const
Animation-time offset of the first frame's start.
std::chrono::milliseconds get_current_frame_begin_time() const
Animation-time offset where the current frame starts.
void set_uses_acceleration(bool uses_accel)
Selects which of the two global timelines get_current_animation_tick() reads for this animation: acce...
void add_frame(const std::chrono::milliseconds &duration, const T &value, bool force_change=false)
Appends a frame, starting where the previous one ends (or at start_time, if first).
const T & get_last_frame() const
std::chrono::milliseconds get_elapsed_time() const
Time since playback began, per get_playback_tick().
const unit_frame & get_current_frame() const
void set_duration_limit(const std::chrono::milliseconds &time)
bool cycles() const
True if the animation loops back to the first frame instead of stopping at the last.
A config object defines a single node in a WML file, with access to child nodes.
Easily build frame parameters with the serialized constructors.
Keep most parameters in a separate class to simplify the handling of the large number of parameters b...
frame_parameters parameters(const std::chrono::milliseconds ¤t_time) const
Getters for the different parameters.
std::set< map_location > get_overlaped_hex(const frame_parameters &value, const map_location &src, const map_location &dst)
void start_animation(const std::chrono::milliseconds &start_time)
frame_parsed_parameters parameters_
std::chrono::milliseconds last_frame_begin_time_
bool need_minimal_update() const
particle(const std::chrono::milliseconds &start_time=std::chrono::milliseconds{0}, const frame_builder &builder=frame_builder())
frame_parameters parameters(const frame_parameters &default_val) const
void redraw(const frame_parameters &value, const map_location &src, const map_location &dst, halo::manager &halo_man)
bool invalidate(frame_parameters &value)
std::vector< config > primary_attack_filter_
std::vector< map_location::direction > directions_
std::vector< int > value2_
bool need_minimal_update() const
std::vector< config > secondary_unit_filter_
void try_advance_to_current_frame()
t_translation::ter_list terrain_types_
void add_frame(const std::chrono::milliseconds &duration, const unit_frame &value, bool force_change=false)
void start_animation(const std::chrono::milliseconds &start_time, const map_location &src=map_location::null_location(), const map_location &dst=map_location::null_location(), const std::string &text="", const color_t text_color={0, 0, 0}, const bool accelerate=true)
frame_parameters get_current_params(const frame_parameters &default_val=frame_parameters()) const
std::chrono::milliseconds get_begin_time() const
std::vector< std::string > event_
int matches(const map_location &loc, const map_location &second_loc, const unit_const_ptr &my_unit, const std::string &event="", const int value=0, strike_result::type hit=strike_result::type::invalid, const const_attack_ptr &attack=nullptr, const const_attack_ptr &second_attack=nullptr, int value2=0) const
std::vector< int > value_
void set_duration_limit(const std::chrono::milliseconds &time)
std::string debug() const
std::map< std::string, particle > sub_anims_
void update_parameters(const map_location &src, const map_location &dst)
std::chrono::milliseconds get_end_time() const
std::vector< std::string > get_flags() const
auto get_current_frame_begin_time() const
auto get_elapsed_time() const
void redraw(frame_parameters &value, halo::manager &halo_man)
std::set< map_location > overlaped_hex_
const unit_frame & get_last_frame() const
friend std::ostream & operator<<(std::ostream &outstream, const unit_animation &u_animation)
static void fill_initial_animations(std::vector< unit_animation > &animations, const config &cfg)
std::vector< config > secondary_attack_filter_
std::vector< config > unit_filter_
static void add_anims(std::vector< unit_animation > &animations, const config &cfg)
std::vector< strike_result::type > hits_
bool animation_finished() const
std::chrono::milliseconds get_elapsed_time() const
std::chrono::milliseconds start_time_
bool has_animation(const unit_const_ptr &animated_unit, const std::string &event, const map_location &src=map_location::null_location(), const map_location &dst=map_location::null_location(), const int value=0, const strike_result::type hit_type=strike_result::type::invalid, const const_attack_ptr &attack=nullptr, const const_attack_ptr &second_attack=nullptr, int value2=0) const
has_animation : return an boolean value if animated unit present and have animation specified,...
std::vector< anim_elem > animated_units_
void wait_for_end() const
void replace_anim_if_invalid(const unit_const_ptr &animated_unit, const std::string &event, const map_location &src=map_location::null_location(), const map_location &dst=map_location::null_location(), const int value=0, bool with_bars=false, const std::string &text="", const color_t text_color={0, 0, 0}, const strike_result::type hit_type=strike_result::type::invalid, const const_attack_ptr &attack=nullptr, const const_attack_ptr &second_attack=nullptr, int value2=0)
void add_animation(unit_const_ptr animated_unit, const unit_animation *animation, const map_location &src=map_location::null_location(), bool with_bars=false, const std::string &text="", const color_t text_color={0, 0, 0})
std::chrono::milliseconds get_end_time() const
void wait_until(const std::chrono::milliseconds &animation_time) const
Describes a unit's animation sequence.
frame_parameters merge_parameters(const std::chrono::milliseconds ¤t_time, const frame_parameters &animation_val, const frame_parameters &engine_val=frame_parameters()) const
This function merges the value provided by:
This class represents a single unit of a specific type.
Definitions for the interface to Wesnoth Markup Language (WML).
Frame for unit's animation sequence.
std::shared_ptr< halo_record > handle
std::vector< terrain_code > ter_list
std::shared_ptr< const unit > unit_const_ptr
std::shared_ptr< const attack_type > const_attack_ptr
rect dst
Location on the final composed sheet.
rect src
Non-transparent portion of the surface to compose.
The basic class for representing 8-bit RGB or RGBA colour values.
All parameters from a frame at a given instant.
Encapsulates the map of the game.
static const map_location & null_location()
const unit_animation * animation