1.2
Public Member Functions | Protected Attributes | List of all members
AnimationBase Class Referenceabstract

Base class for an animation. More...

Inheritance diagram for AnimationBase:
Inheritance graph
[legend]

Public Member Functions

 AnimationBase ()=default
 
 AnimationBase (AnimationBase &&) noexcept=default
 
 AnimationBase (const AnimationBase &)=delete
 
virtual ~AnimationBase () noexcept=default
 
void add_callback (AnimationCallback callback)
 Register a callback for the animation. More...
 
void clear_callbacks ()
 Clear all callbacks. More...
 
virtual bool next ()=0
 Periodic call to the animation. More...
 
AnimationBaseoperator= (AnimationBase &&) noexcept=default
 
AnimationBaseoperator= (const AnimationBase &)=delete
 
virtual void resume ()=0
 Resume the animation. More...
 
virtual EGT_NODISCARD bool running () const
 Returns true if the animation is currently running. More...
 
virtual void start ()=0
 Start the animation. More...
 
virtual void stop ()=0
 Stop the animation. More...
 

Protected Attributes

std::vector< AnimationCallbackm_callbacks
 Registered callbacks for the animation. More...
 
bool m_running {false}
 The running state of the animation. More...
 

Detailed Description

Base class for an animation.

Constructor & Destructor Documentation

◆ AnimationBase() [1/3]

AnimationBase ( )
default

◆ AnimationBase() [2/3]

AnimationBase ( const AnimationBase )
delete

◆ AnimationBase() [3/3]

AnimationBase ( AnimationBase &&  )
defaultnoexcept

◆ ~AnimationBase()

virtual ~AnimationBase ( )
virtualdefaultnoexcept

Member Function Documentation

◆ add_callback()

void add_callback ( AnimationCallback  callback)
inline

Register a callback for the animation.

More than one callback can be registered.

The callback will be called for each step of the animation, usually only when the animation value has actually changed.

Todo:
Need to implement removing callbacks, similar to Object class.

◆ clear_callbacks()

void clear_callbacks ( )
inline

Clear all callbacks.

◆ next()

virtual bool next ( )
pure virtual

Periodic call to the animation.

This must be called until it returns false. When it returns false, the animation is done.

Implemented in AnimationDelay, AnimationSequence, and Animation.

◆ operator=() [1/2]

AnimationBase& operator= ( AnimationBase &&  )
defaultnoexcept

◆ operator=() [2/2]

AnimationBase& operator= ( const AnimationBase )
delete

◆ resume()

virtual void resume ( )
pure virtual

Resume the animation.

Implemented in AnimationDelay, AutoAnimation, AnimationSequence, and Animation.

◆ running()

virtual EGT_NODISCARD bool running ( ) const
inlinevirtual

Returns true if the animation is currently running.

◆ start()

virtual void start ( )
pure virtual

Start the animation.

Implemented in AnimationDelay, AutoAnimation, AnimationSequence, and Animation.

◆ stop()

virtual void stop ( )
pure virtual

Stop the animation.

Implemented in AnimationDelay, AutoAnimation, AnimationSequence, and Animation.

Member Data Documentation

◆ m_callbacks

std::vector<AnimationCallback> m_callbacks
protected

Registered callbacks for the animation.

◆ m_running

bool m_running {false}
protected

The running state of the animation.