#include <animated.hpp>
Public Types | |
typedef std::pair< int, T > | frame_description |
typedef std::vector < frame_description > | anim_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. | |
void | start_animation (int start_time, bool cycles=false) |
Starts an animation cycle. | |
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. | |
bool | animation_finished_potential () const |
int | get_animation_time () const |
int | get_animation_time_potential () const |
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_last_frame () const |
int | get_frames_count () const |
void | force_change () |
bool | does_not_change () const |
Static Public Attributes | |
static const T | void_value_ = T_void_value()() |
Protected Member Functions | |
void | remove_frames_until (int starting_time) |
void | remove_frames_after (int ending_time) |
Protected Attributes | |
int | starting_frame_time_ |
Private Attributes | |
bool | does_not_change_ |
bool | started_ |
bool | need_first_update_ |
std::vector< frame > | frames_ |
int | start_tick_ |
bool | cycles_ |
double | acceleration_ |
int | last_update_tick_ |
int | current_frame_key_ |
Friends | |
class | unit_animation |
Classes | |
struct | frame |
Definition at line 37 of file animated.hpp.
typedef std::pair<int,T> animated< T, T_void_value >::frame_description |
Definition at line 42 of file animated.hpp.
typedef std::vector<frame_description> animated< T, T_void_value >::anim_description |
Definition at line 46 of file animated.hpp.
animated< T, T_void_value >::animated | ( | int | start_time = 0 |
) | [inline] |
Definition at line 46 of file animated.i.
virtual animated< T, T_void_value >::~animated | ( | ) | [inline, virtual] |
Definition at line 42 of file animated.hpp.
animated< T, T_void_value >::animated | ( | const std::vector< frame_description > & | cfg, | |
int | start_time = 0 , |
|||
bool | force_change = false | |||
) | [inline] |
Definition at line 60 of file animated.i.
References animated< T, T_void_value >::add_frame(), and cfg.
void animated< T, T_void_value >::add_frame | ( | int | duration, | |
const T & | value, | |||
bool | force_change = false | |||
) | [inline] |
Adds a frame to an animation.
Definition at line 82 of file animated.i.
References animated< T, T_void_value >::does_not_change_, animated< T, T_void_value >::frames_, and animated< T, T_void_value >::starting_frame_time_.
Referenced by unit_animation::add_frame(), animated< T, T_void_value >::animated(), game_display::game_display(), terrain_builder::rebuild_terrain(), and unit_animation::start_animation().
void animated< T, T_void_value >::start_animation | ( | int | start_time, | |
bool | cycles = false | |||
) | [inline] |
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.
Definition at line 94 of file animated.i.
References animated< T, T_void_value >::acceleration_, animated< T, T_void_value >::current_frame_key_, current_ticks, animated< T, T_void_value >::cycles_, animated< T, T_void_value >::frames_, animated< T, T_void_value >::last_update_tick_, animated< T, T_void_value >::need_first_update_, animated< T, T_void_value >::start_tick_, animated< T, T_void_value >::started_, and animated< T, T_void_value >::starting_frame_time_.
Referenced by terrain_builder::rebuild_terrain(), unit_animation::particule::start_animation(), and terrain_builder::start_animation().
void animated< T, T_void_value >::pause_animation | ( | ) | [inline] |
void animated< T, T_void_value >::restart_animation | ( | ) | [inline] |
int animated< T, T_void_value >::get_begin_time | ( | ) | const [inline] |
Definition at line 290 of file animated.i.
References animated< T, T_void_value >::starting_frame_time_.
Referenced by animated< T, T_void_value >::get_animation_duration(), and unit_animation::get_begin_time().
int animated< T, T_void_value >::get_end_time | ( | ) | const [inline] |
Definition at line 310 of file animated.i.
References animated< T, T_void_value >::frames_, and animated< T, T_void_value >::starting_frame_time_.
Referenced by animated< T, T_void_value >::animation_finished(), animated< T, T_void_value >::animation_finished_potential(), animated< T, T_void_value >::get_animation_duration(), unit_animation::get_end_time(), and animated< T, T_void_value >::update_last_draw_time().
void animated< T, T_void_value >::set_begin_time | ( | int | new_begin_time | ) | [inline] |
Definition at line 340 of file animated.i.
References animated< T, T_void_value >::frames_, and animated< T, T_void_value >::starting_frame_time_.
int animated< T, T_void_value >::time_to_tick | ( | int | animation_time | ) | const [inline] |
Definition at line 296 of file animated.i.
References animated< T, T_void_value >::acceleration_, animated< T, T_void_value >::start_tick_, animated< T, T_void_value >::started_, and animated< T, T_void_value >::starting_frame_time_.
Referenced by unit_animation::time_to_tick().
int animated< T, T_void_value >::tick_to_time | ( | int | animation_tick | ) | const [inline] |
Definition at line 302 of file animated.i.
References animated< T, T_void_value >::acceleration_, animated< T, T_void_value >::start_tick_, animated< T, T_void_value >::started_, and animated< T, T_void_value >::starting_frame_time_.
Referenced by animated< T, T_void_value >::animation_finished_potential(), animated< T, T_void_value >::get_animation_time(), animated< T, T_void_value >::get_animation_time_potential(), and animated< T, T_void_value >::update_last_draw_time().
void animated< T, T_void_value >::update_last_draw_time | ( | double | acceleration = 0 |
) | [inline] |
Definition at line 110 of file animated.i.
References animated< T, T_void_value >::acceleration_, animated< T, T_void_value >::current_frame_key_, current_ticks, animated< T, T_void_value >::cycles_, animated< T, T_void_value >::does_not_change_, animated< T, T_void_value >::frames_, animated< T, T_void_value >::get_animation_duration(), animated< T, T_void_value >::get_animation_time(), animated< T, T_void_value >::get_current_frame_end_time(), animated< T, T_void_value >::get_end_time(), animated< T, T_void_value >::last_update_tick_, animated< T, T_void_value >::need_first_update_, animated< T, T_void_value >::start_tick_, animated< T, T_void_value >::started_, animated< T, T_void_value >::starting_frame_time_, and animated< T, T_void_value >::tick_to_time().
Referenced by unit_animation::update_last_draw_time().
bool animated< T, T_void_value >::need_update | ( | ) | const [inline] |
Reimplemented in unit_animation::particule.
Definition at line 152 of file animated.i.
References animated< T, T_void_value >::acceleration_, current_ticks, animated< T, T_void_value >::does_not_change_, animated< T, T_void_value >::frames_, animated< T, T_void_value >::get_current_frame_end_time(), animated< T, T_void_value >::need_first_update_, animated< T, T_void_value >::start_tick_, and animated< T, T_void_value >::started_.
bool animated< T, T_void_value >::cycles | ( | ) | const [inline] |
Definition at line 70 of file animated.hpp.
bool animated< T, T_void_value >::animation_finished | ( | ) | const [inline] |
Returns true if the current animation was finished.
Definition at line 190 of file animated.i.
References animated< T, T_void_value >::cycles_, animated< T, T_void_value >::frames_, animated< T, T_void_value >::get_animation_time(), animated< T, T_void_value >::get_end_time(), animated< T, T_void_value >::start_tick_, and animated< T, T_void_value >::started_.
Referenced by unit_animation::animation_finished().
bool animated< T, T_void_value >::animation_finished_potential | ( | ) | const [inline] |
Definition at line 176 of file animated.i.
References current_ticks, animated< T, T_void_value >::cycles_, animated< T, T_void_value >::frames_, animated< T, T_void_value >::get_end_time(), animated< T, T_void_value >::start_tick_, animated< T, T_void_value >::started_, and animated< T, T_void_value >::tick_to_time().
Referenced by unit_animation::animation_finished_potential().
int animated< T, T_void_value >::get_animation_time | ( | ) | const [inline] |
Definition at line 213 of file animated.i.
References animated< T, T_void_value >::last_update_tick_, animated< T, T_void_value >::start_tick_, animated< T, T_void_value >::started_, animated< T, T_void_value >::starting_frame_time_, and animated< T, T_void_value >::tick_to_time().
Referenced by animated< T, T_void_value >::animation_finished(), unit_animation::get_animation_time(), animated< T, T_void_value >::get_current_frame_time(), and animated< T, T_void_value >::update_last_draw_time().
int animated< T, T_void_value >::get_animation_time_potential | ( | ) | const [inline] |
Definition at line 205 of file animated.i.
References current_ticks, animated< T, T_void_value >::start_tick_, animated< T, T_void_value >::started_, animated< T, T_void_value >::starting_frame_time_, and animated< T, T_void_value >::tick_to_time().
Referenced by unit_animation::get_animation_time_potential().
int animated< T, T_void_value >::get_animation_duration | ( | ) | const [inline] |
Definition at line 221 of file animated.i.
References animated< T, T_void_value >::get_begin_time(), and animated< T, T_void_value >::get_end_time().
Referenced by animated< T, T_void_value >::update_last_draw_time().
const T & animated< T, T_void_value >::get_current_frame | ( | ) | const [inline] |
Definition at line 227 of file animated.i.
References animated< T, T_void_value >::current_frame_key_, animated< T, T_void_value >::frames_, and animated< T, T_void_value >::void_value_.
int animated< T, T_void_value >::get_current_frame_begin_time | ( | ) | const [inline] |
Definition at line 235 of file animated.i.
References animated< T, T_void_value >::current_frame_key_, animated< T, T_void_value >::frames_, and animated< T, T_void_value >::starting_frame_time_.
Referenced by unit_animation::get_current_frame_begin_time(), animated< T, T_void_value >::get_current_frame_end_time(), and animated< T, T_void_value >::get_current_frame_time().
int animated< T, T_void_value >::get_current_frame_end_time | ( | ) | const [inline] |
Definition at line 243 of file animated.i.
References animated< T, T_void_value >::frames_, animated< T, T_void_value >::get_current_frame_begin_time(), animated< T, T_void_value >::get_current_frame_duration(), and animated< T, T_void_value >::starting_frame_time_.
Referenced by animated< T, T_void_value >::need_update(), and animated< T, T_void_value >::update_last_draw_time().
int animated< T, T_void_value >::get_current_frame_duration | ( | ) | const [inline] |
Definition at line 251 of file animated.i.
References animated< T, T_void_value >::current_frame_key_, and animated< T, T_void_value >::frames_.
Referenced by animated< T, T_void_value >::get_current_frame_end_time().
int animated< T, T_void_value >::get_current_frame_time | ( | ) | const [inline] |
Definition at line 259 of file animated.i.
References animated< T, T_void_value >::frames_, animated< T, T_void_value >::get_animation_time(), and animated< T, T_void_value >::get_current_frame_begin_time().
const T & animated< T, T_void_value >::get_first_frame | ( | ) | const [inline] |
Definition at line 268 of file animated.i.
References animated< T, T_void_value >::frames_, and animated< T, T_void_value >::void_value_.
const T & animated< T, T_void_value >::get_last_frame | ( | ) | const [inline] |
Definition at line 276 of file animated.i.
References animated< T, T_void_value >::frames_, and animated< T, T_void_value >::void_value_.
Referenced by unit_animation::get_last_frame().
int animated< T, T_void_value >::get_frames_count | ( | ) | const [inline] |
void animated< T, T_void_value >::force_change | ( | ) | [inline] |
Definition at line 87 of file animated.hpp.
bool animated< T, T_void_value >::does_not_change | ( | ) | const [inline] |
Definition at line 88 of file animated.hpp.
void animated< T, T_void_value >::remove_frames_until | ( | int | starting_time | ) | [inline, protected] |
Definition at line 317 of file animated.i.
References animated< T, T_void_value >::frames_, and animated< T, T_void_value >::starting_frame_time_.
void animated< T, T_void_value >::remove_frames_after | ( | int | ending_time | ) | [inline, protected] |
Definition at line 326 of file animated.i.
References animated< T, T_void_value >::frames_, and animated< T, T_void_value >::starting_frame_time_.
Referenced by unit_animation::fill_initial_animations().
friend class unit_animation [friend] |
Definition at line 93 of file animated.hpp.
const T animated< T, T_void_value >::void_value_ = T_void_value()() [inline, static] |
Definition at line 90 of file animated.hpp.
Referenced by animated< T, T_void_value >::get_current_frame(), animated< T, T_void_value >::get_first_frame(), and animated< T, T_void_value >::get_last_frame().
int animated< T, T_void_value >::starting_frame_time_ [protected] |
Definition at line 94 of file animated.hpp.
Referenced by animated< T, T_void_value >::add_frame(), animated< T, T_void_value >::get_animation_time(), animated< T, T_void_value >::get_animation_time_potential(), animated< T, T_void_value >::get_begin_time(), animated< T, T_void_value >::get_current_frame_begin_time(), animated< T, T_void_value >::get_current_frame_end_time(), animated< T, T_void_value >::get_end_time(), animated< T, T_void_value >::remove_frames_after(), animated< T, T_void_value >::remove_frames_until(), animated< T, T_void_value >::set_begin_time(), animated< T, T_void_value >::start_animation(), animated< T, T_void_value >::tick_to_time(), animated< T, T_void_value >::time_to_tick(), and animated< T, T_void_value >::update_last_draw_time().
bool animated< T, T_void_value >::does_not_change_ [private] |
Definition at line 116 of file animated.hpp.
Referenced by animated< T, T_void_value >::add_frame(), animated< unit_frame >::does_not_change(), animated< unit_frame >::force_change(), animated< T, T_void_value >::need_update(), and animated< T, T_void_value >::update_last_draw_time().
bool animated< T, T_void_value >::started_ [private] |
Definition at line 117 of file animated.hpp.
Referenced by animated< T, T_void_value >::animation_finished(), animated< T, T_void_value >::animation_finished_potential(), animated< T, T_void_value >::get_animation_time(), animated< T, T_void_value >::get_animation_time_potential(), animated< T, T_void_value >::need_update(), animated< unit_frame >::pause_animation(), animated< unit_frame >::restart_animation(), animated< T, T_void_value >::start_animation(), animated< T, T_void_value >::tick_to_time(), animated< T, T_void_value >::time_to_tick(), and animated< T, T_void_value >::update_last_draw_time().
bool animated< T, T_void_value >::need_first_update_ [private] |
Definition at line 118 of file animated.hpp.
Referenced by animated< T, T_void_value >::need_update(), animated< T, T_void_value >::start_animation(), and animated< T, T_void_value >::update_last_draw_time().
std::vector<frame> animated< T, T_void_value >::frames_ [private] |
Definition at line 119 of file animated.hpp.
Referenced by animated< T, T_void_value >::add_frame(), animated< T, T_void_value >::animation_finished(), animated< T, T_void_value >::animation_finished_potential(), animated< T, T_void_value >::get_current_frame(), animated< T, T_void_value >::get_current_frame_begin_time(), animated< T, T_void_value >::get_current_frame_duration(), animated< T, T_void_value >::get_current_frame_end_time(), animated< T, T_void_value >::get_current_frame_time(), animated< T, T_void_value >::get_end_time(), animated< T, T_void_value >::get_first_frame(), animated< T, T_void_value >::get_frames_count(), animated< T, T_void_value >::get_last_frame(), animated< T, T_void_value >::need_update(), animated< T, T_void_value >::remove_frames_after(), animated< T, T_void_value >::remove_frames_until(), animated< T, T_void_value >::set_begin_time(), animated< T, T_void_value >::start_animation(), and animated< T, T_void_value >::update_last_draw_time().
int animated< T, T_void_value >::start_tick_ [private] |
Definition at line 122 of file animated.hpp.
Referenced by animated< T, T_void_value >::animation_finished(), animated< T, T_void_value >::animation_finished_potential(), animated< T, T_void_value >::get_animation_time(), animated< T, T_void_value >::get_animation_time_potential(), animated< T, T_void_value >::need_update(), animated< unit_frame >::restart_animation(), animated< T, T_void_value >::start_animation(), animated< T, T_void_value >::tick_to_time(), animated< T, T_void_value >::time_to_tick(), and animated< T, T_void_value >::update_last_draw_time().
bool animated< T, T_void_value >::cycles_ [private] |
Definition at line 123 of file animated.hpp.
Referenced by animated< T, T_void_value >::animation_finished(), animated< T, T_void_value >::animation_finished_potential(), animated< unit_frame >::cycles(), animated< T, T_void_value >::start_animation(), and animated< T, T_void_value >::update_last_draw_time().
double animated< T, T_void_value >::acceleration_ [private] |
int animated< T, T_void_value >::last_update_tick_ [private] |
Definition at line 125 of file animated.hpp.
Referenced by animated< T, T_void_value >::get_animation_time(), animated< T, T_void_value >::start_animation(), and animated< T, T_void_value >::update_last_draw_time().
int animated< T, T_void_value >::current_frame_key_ [private] |
Definition at line 126 of file animated.hpp.
Referenced by animated< T, T_void_value >::get_current_frame(), animated< T, T_void_value >::get_current_frame_begin_time(), animated< T, T_void_value >::get_current_frame_duration(), animated< T, T_void_value >::start_animation(), and animated< T, T_void_value >::update_last_draw_time().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |