Public Types | |
| enum | cycle_state { UNSET , CYCLE , NO_CYCLE } |
Public Types inherited from animated< unit_frame > | |
| typedef std::pair< std::chrono::milliseconds, unit_frame > | frame_description |
| typedef std::vector< frame_description > | anim_description |
Public Member Functions | |
| particle (const std::chrono::milliseconds &start_time=std::chrono::milliseconds{0}, const frame_builder &builder=frame_builder()) | |
| particle (const config &cfg, const std::string &frame_string="frame") | |
| virtual | ~particle () |
| bool | need_update () const |
| bool | need_minimal_update () const |
| void | override (const std::chrono::milliseconds &start_time, const std::chrono::milliseconds &duration, const cycle_state cycles, const std::string &highlight="", const std::string &blend_ratio="", color_t blend_color={0, 0, 0}, const std::string &offset="", const std::string &layer="", const std::string &modifiers="") |
| void | redraw (const frame_parameters &value, const map_location &src, const map_location &dst, halo::manager &halo_man) |
| 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_parameters | parameters (const frame_parameters &default_val) const |
| void | clear_halo () |
Public Member Functions inherited from animated< unit_frame > | |
| animated (const std::chrono::milliseconds &start_time=std::chrono::milliseconds{0}) | |
| Creates an animation with no frames; add_frame() populates it afterward. More... | |
| animated (const anim_description &cfg, const std::chrono::milliseconds &start_time=std::chrono::milliseconds{0}, bool force_change=false) | |
| Creates an animation with its frame list already built from cfg. More... | |
| virtual | ~animated ()=default |
| void | add_frame (const std::chrono::milliseconds &duration, const unit_frame &value, bool force_change=false) |
| Appends a frame, starting where the previous one ends (or at start_time, if first). More... | |
| void | start_animation (const std::chrono::milliseconds &start_time_offset, bool cycles=false) |
| Anchors the timeline to the current tick, then begins playback. More... | |
| void | pause_animation () |
| Freezes the timeline in place. More... | |
| void | resume_animation () |
| Shifts the timeline forward by the time spent paused, then continues playback. More... | |
| void | advance_to_current_frame () |
| Moves current_frame_index_ forward to match the current tick, one frame at a time (or in whole cycles, if far enough behind). More... | |
| bool | need_update () const |
| True once the current tick has reached the current frame's end, meaning advance_to_current_frame() has a new frame to move to. More... | |
| bool | animation_finished () const |
| True if playback has run past the last frame, is not yet started, or has no frames. More... | |
| bool | cycles () const |
| True if the animation loops back to the first frame instead of stopping at the last. More... | |
| std::chrono::milliseconds | get_elapsed_time () const |
| Time since playback began, per get_playback_tick(). More... | |
| void | apply_time_offset (const std::chrono::milliseconds &time) |
| Shifts the timeline so the current tick corresponds to the given animation time, then restarts frame tracking from the beginning to resync. More... | |
| void | set_duration_limit (const std::chrono::milliseconds &time) |
| std::chrono::milliseconds | get_animation_duration () const |
| get_end_time() minus get_begin_time(): how long one pass through all frames takes. More... | |
| std::chrono::milliseconds | get_begin_time () const |
| Animation-time offset of the first frame's start. More... | |
| std::chrono::milliseconds | get_end_time () const |
| Animation-time offset where the last frame ends. More... | |
| void | set_begin_time (const std::chrono::milliseconds &new_begin_time) |
| Rebases the timeline onto a new begin time, offsetting every frame's start_time_ by the difference so their durations and order are unchanged. More... | |
| std::chrono::milliseconds | get_current_frame_begin_time () const |
| Animation-time offset where the current frame starts. More... | |
| std::chrono::milliseconds | get_current_frame_end_time () const |
| Animation-time offset where the current frame ends. More... | |
| std::chrono::milliseconds | get_time_in_current_frame () const |
| How far into its own duration the current frame is, clamped to [0, duration]. More... | |
| const unit_frame & | get_current_frame () const |
| const unit_frame & | get_first_frame () const |
| const unit_frame & | get_frame (std::size_t n) const |
| const unit_frame & | get_last_frame () const |
| std::size_t | get_frames_count () const |
| void | force_change () |
| Clears the flag returned by is_static(). More... | |
| bool | is_static () const |
| True when the single-unchanging-frame optimization is enabled: need_update() will always report false, since there is never a different frame to advance to. More... | |
| void | set_uses_acceleration (bool uses_accel) |
| Selects which of the two global timelines get_current_animation_tick() reads for this animation: accelerated if true, normal if false. More... | |
| bool | uses_acceleration () const |
| Which timeline this animation currently reads; see set_uses_acceleration(). More... | |
Private Attributes | |
| frame_parsed_parameters | parameters_ |
| halo::handle | halo_id_ |
| std::chrono::milliseconds | last_frame_begin_time_ |
| bool | cycles_ |
Additional Inherited Members | |
Static Public Attributes inherited from animated< unit_frame > | |
| static const unit_frame | void_value_ |
Protected Member Functions inherited from animated< unit_frame > | |
| void | remove_frames_until (const std::chrono::milliseconds &starting_time) |
| Drops whole frames from the front while their end time is still before starting_time, then advances the begin time by their durations. More... | |
| void | set_end_time (const std::chrono::milliseconds &ending_time) |
| Reduces or extends the frame list so get_end_time() becomes ending_time: drops frames after the cut and shortens the one it falls in, extends the last frame if ending_time is later, or (if ending_time is before the current begin time) collapses to a zero-length first frame. More... | |
Definition at line 110 of file animation.hpp.
| Enumerator | |
|---|---|
| UNSET | |
| CYCLE | |
| NO_CYCLE | |
Definition at line 127 of file animation.hpp.
|
inlineexplicit |
Definition at line 113 of file animation.hpp.
|
explicit |
Definition at line 943 of file animation.cpp.
References animated< unit_frame >::add_frame(), cfg, config::child_range(), cycles_, frame_parsed_parameters::does_not_change(), unit_frame::does_not_change(), unit_frame::duration(), config::empty(), animated< unit_frame >::force_change(), animated< unit_frame >::get_animation_duration(), parameters_, animated< unit_frame >::set_uses_acceleration(), and animated< unit_frame >::starting_frame_time_.
|
virtual |
Definition at line 1294 of file animation.cpp.
| void unit_animation::particle::clear_halo | ( | ) |
Definition at line 1282 of file animation.cpp.
Referenced by unit_animation::clear_haloes().
| std::set< map_location > unit_animation::particle::get_overlaped_hex | ( | const frame_parameters & | value, |
| const map_location & | src, | ||
| const map_location & | dst | ||
| ) |
Definition at line 1287 of file animation.cpp.
References dst, unit_animation::get_begin_time(), unit_animation::get_elapsed_time(), unit_frame::get_overlaped_hex(), and src.
Referenced by unit_animation::invalidate().
| bool unit_animation::particle::need_minimal_update | ( | ) | const |
Definition at line 938 of file animation.cpp.
References unit_animation::get_current_frame_begin_time().
Referenced by unit_animation::need_minimal_update().
| bool unit_animation::particle::need_update | ( | ) | const |
Definition at line 930 of file animation.cpp.
References unit_animation::need_update().
Referenced by unit_animation::need_update(), and unit_animation::try_advance_to_current_frame().
| void unit_animation::particle::override | ( | const std::chrono::milliseconds & | start_time, |
| const std::chrono::milliseconds & | duration, | ||
| const cycle_state | cycles, | ||
| const std::string & | highlight = "", |
||
| const std::string & | blend_ratio = "", |
||
| color_t | blend_color = {0,0,0}, |
||
| const std::string & | offset = "", |
||
| const std::string & | layer = "", |
||
| const std::string & | modifiers = "" |
||
| ) |
Definition at line 904 of file animation.cpp.
References animated< unit_frame >::add_frame(), CYCLE, animated< unit_frame >::cycles(), cycles_, animated< unit_frame >::get_animation_duration(), animated< unit_frame >::get_last_frame(), NO_CYCLE, frame_parsed_parameters::override(), parameters_, animated< unit_frame >::set_begin_time(), and animated< unit_frame >::set_end_time().
|
inline |
Definition at line 140 of file animation.hpp.
References animated< unit_frame >::get_begin_time(), animated< unit_frame >::get_current_frame(), animated< unit_frame >::get_elapsed_time(), animated< unit_frame >::get_time_in_current_frame(), unit_frame::merge_parameters(), frame_parsed_parameters::parameters(), and parameters_.
Referenced by unit_animation::get_current_params().
| void unit_animation::particle::redraw | ( | const frame_parameters & | value, |
| const map_location & | src, | ||
| const map_location & | dst, | ||
| halo::manager & | halo_man | ||
| ) |
Definition at line 1258 of file animation.cpp.
References dst, unit_animation::get_begin_time(), unit_animation::get_current_frame_begin_time(), unit_animation::get_elapsed_time(), unit_frame::redraw(), and src.
Referenced by unit_animation::redraw().
| void unit_animation::particle::start_animation | ( | const std::chrono::milliseconds & | start_time | ) |
Definition at line 1299 of file animation.cpp.
References unit_animation::get_begin_time(), and animated< T >::start_animation().
Referenced by unit_animation::start_animation().
|
private |
Definition at line 151 of file animation.hpp.
Referenced by override(), and particle().
|
private |
Definition at line 149 of file animation.hpp.
|
private |
Definition at line 150 of file animation.hpp.
|
private |
Definition at line 148 of file animation.hpp.
Referenced by override(), parameters(), and particle().