The Battle for Wesnoth  1.19.25+dev
Classes | Functions
animated.hpp File Reference

Frame-based animation system with support for looping, acceleration, and time manipulation. More...

#include <algorithm>
#include <chrono>
#include <vector>
#include "animated.tpp"
Include dependency graph for animated.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  animated< T >
 
struct  animated< T >::frame
 

Functions

void update_animation_timers (double acceleration=1.0)
 Updates both animation timelines. More...
 
std::chrono::steady_clock::time_point get_current_animation_tick (bool uses_acceleration)
 Gets the current time point for animations. More...
 

Detailed Description

Frame-based animation system with support for looping, acceleration, and time manipulation.

The animation system uses two parallel timelines:

Definition in file animated.hpp.

Function Documentation

◆ get_current_animation_tick()

std::chrono::steady_clock::time_point get_current_animation_tick ( bool  uses_acceleration)

Gets the current time point for animations.

Parameters
uses_accelerationIf true, returns accelerated timeline; otherwise normal timeline
Returns
Current time point on the selected timeline

Definition at line 49 of file animated.cpp.

Referenced by unit_animation_component::refresh().

◆ update_animation_timers()

void update_animation_timers ( double  acceleration = 1.0)

Updates both animation timelines.

Should be called once per frame before advancing any animations.

Parameters
accelerationMultiplier for the accelerated timeline (1.0 = normal speed)

Definition at line 38 of file animated.cpp.

Referenced by display::invalidate_animations(), and unit_animator::wait_until().