The Battle for Wesnoth  1.19.7+dev
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes | Friends | List of all members
animated< T > Class Template Reference

#include <animated.hpp>

Classes

struct  frame
 

Public Types

typedef std::pair< std::chrono::milliseconds, T > frame_description
 
typedef std::vector< frame_descriptionanim_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< frameframes_
 
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
 

Detailed Description

template<typename T>
class animated< T >

Definition at line 30 of file animated.hpp.

Member Typedef Documentation

◆ anim_description

template<typename T >
typedef std::vector<frame_description> animated< T >::anim_description

Definition at line 34 of file animated.hpp.

◆ frame_description

template<typename T >
typedef std::pair<std::chrono::milliseconds, T> animated< T >::frame_description

Definition at line 33 of file animated.hpp.

Constructor & Destructor Documentation

◆ animated() [1/2]

template<typename T >
animated< T >::animated ( const std::chrono::milliseconds &  start_time = std::chrono::milliseconds{0})

◆ animated() [2/2]

template<typename T >
animated< T >::animated ( const anim_description cfg,
const std::chrono::milliseconds &  start_time = std::chrono::milliseconds{0},
bool  force_change = false 
)
explicit

◆ ~animated()

template<typename T >
virtual animated< T >::~animated ( )
virtualdefault

Member Function Documentation

◆ add_frame()

template<typename T >
void animated< T >::add_frame ( const std::chrono::milliseconds &  duration,
const T &  value,
bool  force_change = false 
)

◆ animation_finished()

template<typename T >
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().

◆ animation_finished_potential()

template<typename T >
bool animated< T >::animation_finished_potential ( ) const

◆ cycles()

template<typename T >
bool animated< T >::cycles ( ) const
inline

Definition at line 75 of file animated.hpp.

References animated< T >::cycles_.

Referenced by halo::halo_impl::effect::expired().

◆ does_not_change()

template<typename T >
bool animated< T >::does_not_change ( ) const
inline

Definition at line 104 of file animated.hpp.

References animated< T >::does_not_change_.

Referenced by halo::halo_impl::effect::does_change().

◆ force_change()

template<typename T >
void animated< T >::force_change ( )
inline

Definition at line 99 of file animated.hpp.

References animated< T >::does_not_change_.

◆ get_animation_duration()

template<typename T >
std::chrono::milliseconds animated< T >::get_animation_duration ( ) const

◆ get_animation_time()

template<typename T >
std::chrono::milliseconds animated< T >::get_animation_time ( ) const

◆ get_animation_time_potential()

template<typename T >
std::chrono::milliseconds animated< T >::get_animation_time_potential ( ) const

◆ get_begin_time()

template<typename T >
std::chrono::milliseconds animated< T >::get_begin_time ( ) const

◆ get_current_frame()

template<typename T >
const T& animated< T >::get_current_frame ( ) const

◆ get_current_frame_begin_time()

template<typename T >
std::chrono::milliseconds animated< T >::get_current_frame_begin_time ( ) const

◆ get_current_frame_duration()

template<typename T >
std::chrono::milliseconds animated< T >::get_current_frame_duration ( ) const

◆ get_current_frame_end_time()

template<typename T >
std::chrono::milliseconds animated< T >::get_current_frame_end_time ( ) const

◆ get_current_frame_time()

template<typename T >
std::chrono::milliseconds animated< T >::get_current_frame_time ( ) const

◆ get_end_time()

template<typename T >
std::chrono::milliseconds animated< T >::get_end_time ( ) const

◆ get_first_frame()

template<typename T >
const T& animated< T >::get_first_frame ( ) const

◆ get_frame()

template<typename T >
const T& animated< T >::get_frame ( std::size_t  n) const

◆ get_frames_count()

template<typename T >
std::size_t animated< T >::get_frames_count ( ) const

◆ get_last_frame()

template<typename T >
const T& animated< T >::get_last_frame ( ) const

◆ need_update()

template<typename T >
bool animated< T >::need_update ( ) const

◆ not_started()

template<typename T >
bool animated< T >::not_started ( ) const

◆ pause_animation()

template<typename T >
void animated< T >::pause_animation ( )
inline

Definition at line 53 of file animated.hpp.

References animated< T >::started_.

Referenced by unit_animation::pause_animation().

◆ remove_frames_until()

template<typename T >
void animated< T >::remove_frames_until ( const std::chrono::milliseconds &  starting_time)
protected

◆ restart_animation()

template<typename T >
void animated< T >::restart_animation ( )
inline

Definition at line 58 of file animated.hpp.

References animated< T >::start_tick_, and animated< T >::started_.

Referenced by unit_animation::restart_animation().

◆ set_animation_time()

template<typename T >
void animated< T >::set_animation_time ( const std::chrono::milliseconds &  time)

◆ set_begin_time()

template<typename T >
void animated< T >::set_begin_time ( const std::chrono::milliseconds &  new_begin_time)

◆ set_end_time()

template<typename T >
void animated< T >::set_end_time ( const std::chrono::milliseconds &  ending_time)
protected

◆ set_max_animation_time()

template<typename T >
void animated< T >::set_max_animation_time ( const std::chrono::milliseconds &  time)

◆ start_animation()

template<typename T >
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().

◆ tick_to_time()

template<typename T >
std::chrono::milliseconds animated< T >::tick_to_time ( const std::chrono::steady_clock::time_point &  animation_tick) const

◆ time_to_tick()

template<typename T >
std::chrono::steady_clock::time_point animated< T >::time_to_tick ( const std::chrono::milliseconds &  animation_time) const

◆ update_last_draw_time()

template<typename T >
void animated< T >::update_last_draw_time ( double  acceleration = 0)

Friends And Related Function Documentation

◆ unit_animation

template<typename T >
friend class unit_animation
friend

Definition at line 112 of file animated.hpp.

Member Data Documentation

◆ acceleration_

template<typename T >
double animated< T >::acceleration_
private

Definition at line 140 of file animated.hpp.

◆ current_frame_key_

template<typename T >
int animated< T >::current_frame_key_
private

Definition at line 142 of file animated.hpp.

◆ cycles_

template<typename T >
bool animated< T >::cycles_
private

Definition at line 139 of file animated.hpp.

Referenced by animated< T >::cycles().

◆ does_not_change_

template<typename T >
bool animated< T >::does_not_change_
private

Definition at line 128 of file animated.hpp.

Referenced by animated< T >::does_not_change(), and animated< T >::force_change().

◆ force_next_update_

template<typename T >
bool animated< T >::force_next_update_
private

Definition at line 130 of file animated.hpp.

◆ frames_

template<typename T >
std::vector<frame> animated< T >::frames_
private

Definition at line 131 of file animated.hpp.

◆ last_update_tick_

template<typename T >
std::chrono::steady_clock::time_point animated< T >::last_update_tick_
private

Definition at line 141 of file animated.hpp.

◆ max_animation_time_

template<typename T >
std::chrono::milliseconds animated< T >::max_animation_time_
private

Definition at line 135 of file animated.hpp.

◆ start_tick_

template<typename T >
std::chrono::steady_clock::time_point animated< T >::start_tick_
private

Definition at line 138 of file animated.hpp.

Referenced by animated< T >::restart_animation().

◆ started_

template<typename T >
bool animated< T >::started_
private

◆ starting_frame_time_

template<typename T >
std::chrono::milliseconds animated< T >::starting_frame_time_
protected

Definition at line 117 of file animated.hpp.

◆ void_value_

template<typename T >
const T animated< T >::void_value_
static

Definition at line 109 of file animated.hpp.


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