The Battle for Wesnoth  1.15.0-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< int, T > frame_description
 
typedef std::vector< frame_descriptionanim_description
 

Public Member Functions

 animated (int start_time=0)
 
virtual ~animated ()
 
 animated (const std::vector< frame_description > &cfg, int start_time=0, bool force_change=false)
 
void add_frame (int duration, const T &value, bool force_change=false)
 Adds a frame to an animation. More...
 
void start_animation (int start_time, bool cycles=false)
 Starts an animation cycle. More...
 
void pause_animation ()
 
void restart_animation ()
 
int get_begin_time () const
 
int get_end_time () const
 
void set_begin_time (int new_begin_time)
 
int time_to_tick (int animation_time) const
 
int tick_to_time (int 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
 
int get_animation_time () const
 
int get_animation_time_potential () const
 
void set_animation_time (int time)
 
void set_max_animation_time (int time)
 
int get_animation_duration () const
 
const T & get_current_frame () const
 
int get_current_frame_begin_time () const
 
int get_current_frame_end_time () const
 
int get_current_frame_duration () const
 
int 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 (int starting_time)
 
void set_end_time (int ending_time)
 

Protected Attributes

int starting_frame_time_
 

Private Attributes

bool does_not_change_
 
bool started_
 
bool force_next_update_
 
std::vector< frameframes_
 
int max_animation_time_
 
int start_tick_
 
bool cycles_
 
double acceleration_
 
int 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 37 of file animated.hpp.

◆ frame_description

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

Definition at line 36 of file animated.hpp.

Constructor & Destructor Documentation

◆ animated() [1/2]

template<typename T>
animated< T >::animated ( int  start_time = 0)

◆ ~animated()

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

Definition at line 34 of file animated.hpp.

◆ animated() [2/2]

template<typename T>
animated< T >::animated ( const std::vector< frame_description > &  cfg,
int  start_time = 0,
bool  force_change = false 
)

Member Function Documentation

◆ add_frame()

template<typename T>
void animated< T >::add_frame ( int  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(), animated< unit_frame >::cycles(), 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 71 of file animated.hpp.

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

◆ does_not_change()

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

Definition at line 100 of file animated.hpp.

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

◆ force_change()

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

Definition at line 95 of file animated.hpp.

◆ get_animation_duration()

template<typename T>
int animated< T >::get_animation_duration ( ) const

◆ get_animation_time()

template<typename T>
int animated< T >::get_animation_time ( ) const

◆ get_animation_time_potential()

template<typename T>
int animated< T >::get_animation_time_potential ( ) const

◆ get_begin_time()

template<typename T>
int 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>
int animated< T >::get_current_frame_begin_time ( ) const

◆ get_current_frame_duration()

template<typename T>
int animated< T >::get_current_frame_duration ( ) const

◆ get_current_frame_end_time()

template<typename T>
int animated< T >::get_current_frame_end_time ( ) const

◆ get_current_frame_time()

template<typename T>
int animated< T >::get_current_frame_time ( ) const

◆ get_end_time()

template<typename T>
int 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

◆ pause_animation()

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

Definition at line 50 of file animated.hpp.

Referenced by unit_animation::pause_animation().

◆ remove_frames_until()

template<typename T>
void animated< T >::remove_frames_until ( int  starting_time)
protected

◆ restart_animation()

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

Definition at line 55 of file animated.hpp.

Referenced by unit_animation::restart_animation().

◆ set_animation_time()

template<typename T>
void animated< T >::set_animation_time ( int  time)

◆ set_begin_time()

template<typename T>
void animated< T >::set_begin_time ( int  new_begin_time)

◆ set_end_time()

template<typename T>
void animated< T >::set_end_time ( int  ending_time)
protected

◆ set_max_animation_time()

template<typename T>
void animated< T >::set_max_animation_time ( int  time)

◆ start_animation()

template<typename T>
void animated< T >::start_animation ( int  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(), display::init_flags(), terrain_builder::load_images(), terrain_builder::rebuild_terrain(), and unit_animation::particle::start_animation().

◆ tick_to_time()

template<typename T>
int animated< T >::tick_to_time ( int  animation_tick) const

◆ time_to_tick()

template<typename T>
int animated< T >::time_to_tick ( int  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 108 of file animated.hpp.

Member Data Documentation

◆ acceleration_

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

Definition at line 148 of file animated.hpp.

◆ current_frame_key_

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

Definition at line 150 of file animated.hpp.

◆ cycles_

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

Definition at line 147 of file animated.hpp.

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

◆ does_not_change_

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

◆ force_next_update_

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

Definition at line 138 of file animated.hpp.

◆ frames_

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

Definition at line 139 of file animated.hpp.

◆ last_update_tick_

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

Definition at line 149 of file animated.hpp.

◆ max_animation_time_

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

Definition at line 143 of file animated.hpp.

◆ start_tick_

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

Definition at line 146 of file animated.hpp.

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

◆ started_

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

◆ starting_frame_time_

template<typename T>
int animated< T >::starting_frame_time_
protected

Definition at line 109 of file animated.hpp.

◆ void_value_

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

Definition at line 105 of file animated.hpp.


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