JugiMap Framework
TimelineAnimationInstance Class Reference

A class for using timeline animations in animation players. More...

#include <jmTimelineAnimationInstance.h>

Inherits AnimationInstance.

Public Member Functions

 TimelineAnimationInstance (TimelineAnimation *_timelineAnimation, Sprite *_sprite)
 Constructor. More...
 
 TimelineAnimationInstance (TimelineAnimation *_timelineAnimation, std::vector< Sprite * > &_sprites)
 Constructor. More...
 
 ~TimelineAnimationInstance () override
 Destructor. More...
 
SpriteGetSprite ()
 Returns the assigned sprite; if a vector of sprites has been assigned it returns nullptr! More...
 
std::vector< Sprite * > * GetSprites ()
 Returns a pointer to the vector of assigned sprites; if one sprite has been assigned it returns nullptr. More...
 
std::vector< AnimationMemberState * > & GetAnimationsMemberStates ()
 Returns a reference to the vector of animation members. More...
 
AnimationTrackState * GetMetaAnimationTrackState ()
 Returns a pointer to meta track state. If the animation has no meta track returns nullptr. More...
 
int Update (int msTimePoint, int _flags) override
 Update the animation state for the given msTimePoint. More...
 
void UpdateAnimatedSprites (bool _resetSpriteAnimatedProperties) override
 Update the animated sprites. More...
 
AnimationMemberState * FindAnimationMemberState (AnimationMember *_animationMember)
 Returns a pointer to animation member state object of the given *_animationMember*. If the animation member is not found it returns nullptr. More...
 
AnimationTrackState * FindAnimationTrackState (AnimationTrackKind _animationTrackKind, const std::string &_memberName="")
 Returns a pointer to animation track state object of the given AnimationTrackKind within the member with the given *_memberName*. If the track state was not found it returns nullptr. More...
 
AnimationTrackState * FindAnimationTrackState (AnimationTrack *_animationTrack)
 Returns a pointer to animation track state object of the given *_animationTrack*. If the animation track was not found it returns nullptr. More...
 
- Public Member Functions inherited from AnimationInstance
AnimationKind GetKind ()
 Returns the kind of this animation. More...
 
AnimationGetAnimation ()
 Returns the animation object of this animation instance. More...
 
AnimationBaseParametersGetBaseParameters ()
 Returns the base animation parameters of this animation instance. More...
 
void SetCompleteLoops (bool _completeLoops)
 Set a parameter which indicates that the animation should finish its current loop before ending. More...
 
bool GetCompleteLoops ()
 Returns the completeLoops parameter of this animation instance. More...
 
void SetSpeedFactor (float _fSpeed)
 Set the speed factor of animation playback. The value 1.0 is the default speed; higher values means faster animation and lower values means slower animation. More...
 
float GetSpeedFactor ()
 Returns the speed factor of this animation instance. More...
 
void SetStartPlayTimeOffset (int _startPlayTimeOffset)
 Set the animation starting time point offset in milliseconds. More...
 
int GetStartPlayTimeOffset ()
 Returns the animation starting time point offset of this animation instance. More...
 

Detailed Description

A class for using timeline animations in animation players.

Constructor & Destructor Documentation

◆ TimelineAnimationInstance() [1/2]

TimelineAnimationInstance ( TimelineAnimation _timelineAnimation,
Sprite _sprite 
)

Constructor.

Create an TimelineAnimationInstance object for animating the given sprite *_sprite* with the given timeline animation *_animation*.

◆ TimelineAnimationInstance() [2/2]

TimelineAnimationInstance ( TimelineAnimation _timelineAnimation,
std::vector< Sprite * > &  _sprites 
)

Constructor.

Create an TimelineAnimationInstance object for animating the given sprites *_sprites* with the given timeline animation *_animation*. The sprites must have the same SourceSprite!

◆ ~TimelineAnimationInstance()

Destructor.

Member Function Documentation

◆ GetSprite()

Sprite* GetSprite ( )
inline

Returns the assigned sprite; if a vector of sprites has been assigned it returns nullptr!

◆ GetSprites()

std::vector<Sprite*>* GetSprites ( )
inline

Returns a pointer to the vector of assigned sprites; if one sprite has been assigned it returns nullptr.

The vector of assigned sprites object is owned by FrameAnimationInstance object! Sprites themselves are link pointers.

◆ GetAnimationsMemberStates()

std::vector<AnimationMemberState*>& GetAnimationsMemberStates ( )
inline

Returns a reference to the vector of animation members.

◆ GetMetaAnimationTrackState()

AnimationTrackState* GetMetaAnimationTrackState ( )
inline

Returns a pointer to meta track state. If the animation has no meta track returns nullptr.

◆ Update()

int Update ( int  msTimePoint,
int  _flags 
)
overridevirtual

Update the animation state for the given msTimePoint.

This function is usually called by animation players.

Implements AnimationInstance.

◆ UpdateAnimatedSprites()

void UpdateAnimatedSprites ( bool  _resetSpriteAnimatedProperties)
overridevirtual

Update the animated sprites.

This function must be called manually when an animation player updates animation and returns PlayingAnimationFlags::ANIMATED_PROPERTIES_CHANGED flag. The parameter *_resetSpriteAnimatedProperties* must be set in the following way:

  • If one animation instance is used to animate a sprite the parameter is true.
  • If more animation instances (via more players) is used to animating the same sprite, the parameter is true for the first processed instance and false for the others.

Implements AnimationInstance.

◆ FindAnimationMemberState()

AnimationMemberState * FindAnimationMemberState ( AnimationMember *  _animationMember)

Returns a pointer to animation member state object of the given *_animationMember*. If the animation member is not found it returns nullptr.

◆ FindAnimationTrackState() [1/2]

AnimationTrackState * FindAnimationTrackState ( AnimationTrackKind  _animationTrackKind,
const std::string &  _memberName = "" 
)

Returns a pointer to animation track state object of the given AnimationTrackKind within the member with the given *_memberName*. If the track state was not found it returns nullptr.

◆ FindAnimationTrackState() [2/2]

AnimationTrackState * FindAnimationTrackState ( AnimationTrack *  _animationTrack)

Returns a pointer to animation track state object of the given *_animationTrack*. If the animation track was not found it returns nullptr.


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