The Battle for Wesnoth  1.19.26+dev
Public Types | Public Member Functions | Private Attributes | List of all members
unit_animation::particle Class Reference
Inheritance diagram for unit_animation::particle:

Public Types

enum  cycle_state { UNSET , CYCLE , NO_CYCLE }
 
- Public Types inherited from animated< unit_frame >
typedef std::pair< std::chrono::milliseconds, unit_frameframe_description
 
typedef std::vector< frame_descriptionanim_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_locationget_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_frameget_current_frame () const
 
const unit_frameget_first_frame () const
 
const unit_frameget_frame (std::size_t n) const
 
const unit_frameget_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...
 

Detailed Description

Definition at line 110 of file animation.hpp.

Member Enumeration Documentation

◆ cycle_state

Enumerator
UNSET 
CYCLE 
NO_CYCLE 

Definition at line 127 of file animation.hpp.

Constructor & Destructor Documentation

◆ particle() [1/2]

unit_animation::particle::particle ( const std::chrono::milliseconds &  start_time = std::chrono::milliseconds{0},
const frame_builder builder = frame_builder() 
)
inlineexplicit

Definition at line 113 of file animation.hpp.

◆ particle() [2/2]

unit_animation::particle::particle ( const config cfg,
const std::string &  frame_string = "frame" 
)
explicit

◆ ~particle()

unit_animation::particle::~particle ( )
virtual

Definition at line 1294 of file animation.cpp.

Member Function Documentation

◆ clear_halo()

void unit_animation::particle::clear_halo ( )

Definition at line 1282 of file animation.cpp.

Referenced by unit_animation::clear_haloes().

◆ get_overlaped_hex()

std::set< map_location > unit_animation::particle::get_overlaped_hex ( const frame_parameters value,
const map_location src,
const map_location dst 
)

◆ need_minimal_update()

bool unit_animation::particle::need_minimal_update ( ) const

◆ need_update()

bool unit_animation::particle::need_update ( ) const

◆ override()

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 = "" 
)

◆ parameters()

frame_parameters unit_animation::particle::parameters ( const frame_parameters default_val) const
inline

◆ redraw()

void unit_animation::particle::redraw ( const frame_parameters value,
const map_location src,
const map_location dst,
halo::manager halo_man 
)

◆ start_animation()

void unit_animation::particle::start_animation ( const std::chrono::milliseconds &  start_time)

Member Data Documentation

◆ cycles_

bool unit_animation::particle::cycles_
private

Definition at line 151 of file animation.hpp.

Referenced by override(), and particle().

◆ halo_id_

halo::handle unit_animation::particle::halo_id_
private

Definition at line 149 of file animation.hpp.

◆ last_frame_begin_time_

std::chrono::milliseconds unit_animation::particle::last_frame_begin_time_
private

Definition at line 150 of file animation.hpp.

◆ parameters_

frame_parsed_parameters unit_animation::particle::parameters_
private

Definition at line 148 of file animation.hpp.

Referenced by override(), parameters(), and particle().


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