#include <animated.hpp>
Classes | |
struct | frame |
Public Types | |
typedef std::pair< std::chrono::milliseconds, T > | frame_description |
typedef std::vector< frame_description > | anim_description |
Public Member Functions | |
animated (const std::chrono::milliseconds &start_time=std::chrono::milliseconds{0}) | |
animated (const anim_description &cfg, const std::chrono::milliseconds &start_time=std::chrono::milliseconds{0}, bool force_change=false) | |
virtual | ~animated ()=default |
void | add_frame (const std::chrono::milliseconds &duration, const T &value, bool force_change=false) |
Adds a frame to an animation. More... | |
bool | not_started () const |
void | start_animation (const std::chrono::milliseconds &start_time, bool cycles=false) |
Starts an animation cycle. More... | |
void | pause_animation () |
void | restart_animation () |
std::chrono::milliseconds | get_begin_time () const |
std::chrono::milliseconds | get_end_time () const |
void | set_begin_time (const std::chrono::milliseconds &new_begin_time) |
std::chrono::steady_clock::time_point | time_to_tick (const std::chrono::milliseconds &animation_time) const |
std::chrono::milliseconds | tick_to_time (const std::chrono::steady_clock::time_point &animation_tick) const |
void | update_last_draw_time (double acceleration=0) |
bool | need_update () const |
bool | cycles () const |
bool | animation_finished () const |
Returns true if the current animation was finished. More... | |
bool | animation_finished_potential () const |
std::chrono::milliseconds | get_animation_time () const |
std::chrono::milliseconds | get_animation_time_potential () const |
void | set_animation_time (const std::chrono::milliseconds &time) |
void | set_max_animation_time (const std::chrono::milliseconds &time) |
std::chrono::milliseconds | get_animation_duration () const |
const T & | get_current_frame () const |
std::chrono::milliseconds | get_current_frame_begin_time () const |
std::chrono::milliseconds | get_current_frame_end_time () const |
std::chrono::milliseconds | get_current_frame_duration () const |
std::chrono::milliseconds | get_current_frame_time () const |
const T & | get_first_frame () const |
const T & | get_frame (std::size_t n) const |
const T & | get_last_frame () const |
std::size_t | get_frames_count () const |
void | force_change () |
bool | does_not_change () const |
Static Public Attributes | |
static const T | void_value_ |
Protected Member Functions | |
void | remove_frames_until (const std::chrono::milliseconds &starting_time) |
void | set_end_time (const std::chrono::milliseconds &ending_time) |
Protected Attributes | |
std::chrono::milliseconds | starting_frame_time_ |
Private Attributes | |
bool | does_not_change_ |
bool | started_ |
bool | force_next_update_ |
std::vector< frame > | frames_ |
std::chrono::milliseconds | max_animation_time_ |
std::chrono::steady_clock::time_point | start_tick_ |
bool | cycles_ |
double | acceleration_ |
std::chrono::steady_clock::time_point | last_update_tick_ |
int | current_frame_key_ |
Friends | |
class | unit_animation |
Definition at line 30 of file animated.hpp.
typedef std::vector<frame_description> animated< T >::anim_description |
Definition at line 34 of file animated.hpp.
typedef std::pair<std::chrono::milliseconds, T> animated< T >::frame_description |
Definition at line 33 of file animated.hpp.
animated< T >::animated | ( | const std::chrono::milliseconds & | start_time = std::chrono::milliseconds{0} | ) |
|
explicit |
void animated< T >::add_frame | ( | const std::chrono::milliseconds & | duration, |
const T & | value, | ||
bool | force_change = false |
||
) |
Adds a frame to an animation.
Referenced by unit_animation::add_frame(), terrain_builder::load_images(), terrain_builder::rebuild_terrain(), display::reinit_flags_for_team(), and unit_animation::start_animation().
bool animated< T >::animation_finished | ( | ) | const |
Returns true if the current animation was finished.
Referenced by unit_animation::animation_finished(), and halo::halo_impl::effect::expired().
bool animated< T >::animation_finished_potential | ( | ) | const |
Referenced by unit_animation::animation_finished_potential().
|
inline |
Definition at line 75 of file animated.hpp.
References animated< T >::cycles_.
Referenced by halo::halo_impl::effect::expired().
|
inline |
Definition at line 104 of file animated.hpp.
References animated< T >::does_not_change_.
Referenced by halo::halo_impl::effect::does_change().
|
inline |
Definition at line 99 of file animated.hpp.
References animated< T >::does_not_change_.
std::chrono::milliseconds animated< T >::get_animation_duration | ( | ) | const |
Referenced by terrain_builder::tile::rebuild_cache().
std::chrono::milliseconds animated< T >::get_animation_time | ( | ) | const |
Referenced by unit_animation::get_animation_time().
std::chrono::milliseconds animated< T >::get_animation_time_potential | ( | ) | const |
Referenced by unit_animation::get_animation_time_potential().
std::chrono::milliseconds animated< T >::get_begin_time | ( | ) | const |
Referenced by unit_animation::get_begin_time().
const T& animated< T >::get_current_frame | ( | ) | const |
Referenced by halo::halo_impl::effect::current_image().
std::chrono::milliseconds animated< T >::get_current_frame_begin_time | ( | ) | const |
Referenced by unit_animation::get_current_frame_begin_time().
std::chrono::milliseconds animated< T >::get_current_frame_duration | ( | ) | const |
std::chrono::milliseconds animated< T >::get_current_frame_end_time | ( | ) | const |
std::chrono::milliseconds animated< T >::get_current_frame_time | ( | ) | const |
std::chrono::milliseconds animated< T >::get_end_time | ( | ) | const |
Referenced by unit_animation::get_end_time().
const T& animated< T >::get_first_frame | ( | ) | const |
const T& animated< T >::get_frame | ( | std::size_t | n | ) | const |
Referenced by terrain_builder::tile::rebuild_cache().
std::size_t animated< T >::get_frames_count | ( | ) | const |
Referenced by terrain_builder::load_images(), and terrain_builder::tile::rebuild_cache().
const T& animated< T >::get_last_frame | ( | ) | const |
Referenced by unit_animation::get_last_frame().
bool animated< T >::need_update | ( | ) | const |
Referenced by halo::halo_impl::effect::need_update(), and terrain_builder::update_animation().
bool animated< T >::not_started | ( | ) | const |
|
inline |
Definition at line 53 of file animated.hpp.
References animated< T >::started_.
Referenced by unit_animation::pause_animation().
|
protected |
|
inline |
Definition at line 58 of file animated.hpp.
References animated< T >::start_tick_, and animated< T >::started_.
Referenced by unit_animation::restart_animation().
void animated< T >::set_animation_time | ( | const std::chrono::milliseconds & | time | ) |
void animated< T >::set_begin_time | ( | const std::chrono::milliseconds & | new_begin_time | ) |
|
protected |
void animated< T >::set_max_animation_time | ( | const std::chrono::milliseconds & | time | ) |
Referenced by unit_animation::set_max_animation_time().
void animated< T >::start_animation | ( | const std::chrono::milliseconds & | start_time, |
bool | cycles = false |
||
) |
Starts an animation cycle.
The first frame of the animation to start may be set to any value by using a start_time different to 0.
Referenced by halo::halo_impl::effect::effect(), terrain_builder::load_images(), terrain_builder::rebuild_terrain(), and unit_animation::particle::start_animation().
std::chrono::milliseconds animated< T >::tick_to_time | ( | const std::chrono::steady_clock::time_point & | animation_tick | ) | const |
std::chrono::steady_clock::time_point animated< T >::time_to_tick | ( | const std::chrono::milliseconds & | animation_time | ) | const |
Referenced by unit_animation::time_to_tick().
void animated< T >::update_last_draw_time | ( | double | acceleration = 0 | ) |
Referenced by terrain_builder::update_animation(), and unit_animation::update_last_draw_time().
|
friend |
Definition at line 112 of file animated.hpp.
|
private |
Definition at line 140 of file animated.hpp.
|
private |
Definition at line 142 of file animated.hpp.
|
private |
Definition at line 139 of file animated.hpp.
Referenced by animated< T >::cycles().
|
private |
Definition at line 128 of file animated.hpp.
Referenced by animated< T >::does_not_change(), and animated< T >::force_change().
|
private |
Definition at line 130 of file animated.hpp.
Definition at line 131 of file animated.hpp.
|
private |
Definition at line 141 of file animated.hpp.
|
private |
Definition at line 135 of file animated.hpp.
|
private |
Definition at line 138 of file animated.hpp.
Referenced by animated< T >::restart_animation().
|
private |
Definition at line 129 of file animated.hpp.
Referenced by animated< T >::pause_animation(), and animated< T >::restart_animation().
|
protected |
Definition at line 117 of file animated.hpp.
|
static |
Definition at line 109 of file animated.hpp.