FuncDoodle
Loading...
Searching...
No Matches
FuncDoodle::AnimationPlayer Class Reference

Responsible for playing a users' animation. More...

#include <Player.h>

Public Member Functions

 AnimationPlayer (const SharedPtr< ProjectFile > &proj)
 Creates a player for a project.
 ~AnimationPlayer ()
void Play ()
 Advances playback based on elapsed time.
void Rewind ()
 Resets playback to the first frame.
void End ()
 Jumps playback to the final frame.
constexpr void SetPlaying (bool playing)
 Sets whether playback is active.
constexpr bool Playing () const
 Returns whether playback is currently active.
void SetProj (SharedPtr< ProjectFile > proj)
 Replaces the project used for playback.
SharedPtr< ProjectFileProj () const
 Returns the project used for playback.
constexpr unsigned long CurFrame () const
 Returns the current playback frame index.
constexpr void SetCurFrame (unsigned long frame)
 Sets the current playback frame index.

Private Attributes

bool m_Playing
SharedPtr< ProjectFilem_Proj
unsigned long m_CurFrame = 0L
float m_TimeElapsed = 0.0f

Detailed Description

Responsible for playing a users' animation.

Invariant
m_CurFrame is always a valid frame index within m_Proj
Note
Play() advances frames over time using m_TimeElapsed
AnimationPlayer maintains internal playback state (frame + time accumulator)
Rewind() resets playback to the first frame

Constructor & Destructor Documentation

◆ AnimationPlayer()

FuncDoodle::AnimationPlayer::AnimationPlayer ( const SharedPtr< ProjectFile > & proj)

Creates a player for a project.

Parameters
projProject whose frames will be played back.

◆ ~AnimationPlayer()

FuncDoodle::AnimationPlayer::~AnimationPlayer ( )
default

Member Function Documentation

◆ CurFrame()

unsigned long FuncDoodle::AnimationPlayer::CurFrame ( ) const
inlinenodiscardconstexpr

Returns the current playback frame index.

Returns
Current frame index.

◆ End()

void FuncDoodle::AnimationPlayer::End ( )

Jumps playback to the final frame.

◆ Play()

void FuncDoodle::AnimationPlayer::Play ( )

Advances playback based on elapsed time.

◆ Playing()

bool FuncDoodle::AnimationPlayer::Playing ( ) const
inlinenodiscardconstexpr

Returns whether playback is currently active.

Returns
Playback state.

◆ Proj()

SharedPtr< ProjectFile > FuncDoodle::AnimationPlayer::Proj ( ) const
inlinenodiscard

Returns the project used for playback.

Returns
Shared pointer to the active project.

◆ Rewind()

void FuncDoodle::AnimationPlayer::Rewind ( )

Resets playback to the first frame.

◆ SetCurFrame()

void FuncDoodle::AnimationPlayer::SetCurFrame ( unsigned long frame)
inlineconstexpr

Sets the current playback frame index.

Parameters
frameFrame index to jump to.

◆ SetPlaying()

void FuncDoodle::AnimationPlayer::SetPlaying ( bool playing)
inlineconstexpr

Sets whether playback is active.

Parameters
playingNew playback state.

◆ SetProj()

void FuncDoodle::AnimationPlayer::SetProj ( SharedPtr< ProjectFile > proj)
inline

Replaces the project used for playback.

Parameters
projProject to play.

Member Data Documentation

◆ m_CurFrame

unsigned long FuncDoodle::AnimationPlayer::m_CurFrame = 0L
private

◆ m_Playing

bool FuncDoodle::AnimationPlayer::m_Playing
private

◆ m_Proj

SharedPtr<ProjectFile> FuncDoodle::AnimationPlayer::m_Proj
private

◆ m_TimeElapsed

float FuncDoodle::AnimationPlayer::m_TimeElapsed = 0.0f
private

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