1 #ifndef JUGIMAP_ANIMATION_COMMON_H
2 #define JUGIMAP_ANIMATION_COMMON_H
5 #include "jmCommonFunctions.h"
19 class AnimationTrackState;
22 class JugiMapBinaryLoader;
33 GraphicItem *texture =
nullptr;
45 struct AnimatedProperties
50 float rotation = 0.0f;
54 ColorRGBA colorOverlayRGBA = 0;
56 GraphicItem *graphicItem =
nullptr;
60 void Append(AnimatedProperties &ap);
142 unsigned char dataFlags = 0;
143 std::vector<Parameter> parameters;
177 virtual int Update(
int msTimePoint,
int _flags) = 0;
189 virtual void ResetAnimatedProperties() = 0;
190 virtual void OnPlayingStart(){}
191 virtual void OnPlayingStop(){}
239 bool completeLoops =
true;
240 int startPlayTimeOffset = 0;
253 int Update(
int msTimePoint,
int _flags)
override {
return 0;}
255 void ResetAnimatedProperties()
override {}
327 int msCurrentAnimationTime = -1;
328 int msStartPlayOffset = 0;
329 int msAnimationTimeStart = -1;
333 int msTimeStored = 0;
336 AKMeta* activeControllerKey =
nullptr;
339 int UpdateAnimationInstance();
340 int GetRepeatTime(
int _msCurrentTime);
404 std::vector<AnimationInstance*>animationInstances;
406 int PlayNextAnimationInQueue();
410 extern DummyNoAnimationInstance dummyNoAnimationInstance;
411 extern AnimationPlayer *activeTimelineAnimationPlayer;
419 #endif // EANIMATIONCOMMON_H
int GetCurrentAnimationTime()
Returns the current animation time in milliseconds.
Definition: jmAnimationCommon.h:367
int Stop()
Stop the played animation and put the player into the idle state.
Definition: jmAnimationCommon.cpp:349
The queue animation player for playing animations via animationInstance objects.
Definition: jmAnimationCommon.h:353
AnimationBaseParameters & GetAnimationBaseParameters()
Returns a reference to the animation base parameters.
Definition: jmAnimationCommon.h:319
AnimationInstance * GetAnimationInstance()
Returns the played animation instance.
Definition: jmAnimationCommon.h:273
AnimationKind GetKind()
Returns the kind of this animation.
Definition: jmAnimationCommon.h:106
virtual int Update(int msTimePoint, int _flags)=0
Update the animation state for the given msTimePoint.
int repeat_DelayTimeEnd
The repeat delay - end point time in milliseconds. The actual repeat delay is a random value between ...
Definition: jmAnimationCommon.h:84
int GetDataFlags()
Returns the dataFlags factor of this frame animation.
Definition: jmAnimationCommon.h:126
std::string GetName()
Returns the name of this animation.
Definition: jmAnimationCommon.h:114
int repeat_DelayTimeStart
The repeat delay - start point time in milliseconds.
Definition: jmAnimationCommon.h:83
Vec2< int > Vec2i
Vec2 struct in integer precision.
Definition: jmCommon.h:166
The player is idle and has assigned no animation instance.
int GetDuration()
Returns duration of this animation in milliseconds. This is duration of one loop.
Definition: jmAnimationCommon.h:130
void UpdateAnimatedSprites(bool _resetAnimatedProperties) override
Update the animated sprites.
Definition: jmAnimationCommon.h:254
virtual ~Animation()
Destructor.
Definition: jmAnimationCommon.h:153
The base animation instance class.
Definition: jmAnimationCommon.h:163
AnimationBaseParameters & GetBaseParameters()
Returns a reference to the base parameters of this animation.
Definition: jmAnimationCommon.h:118
AKMeta * GetActiveMetaKey()
Returns the active meta key of the played animation or nullptr if none.
Definition: jmAnimationCommon.h:375
virtual void UpdateAnimatedSprites(bool _resetSpriteAnimatedProperties)=0
Update the animated sprites.
AnimationPlayerState GetState()
Returns the state of this player.
Definition: jmAnimationCommon.h:281
bool startAtRepeatTime
Start the animation after the repeat delay (overrides the starting delay).
Definition: jmAnimationCommon.h:85
AnimationInstance * GetAnimationInstance()
Returns the played animation instance.
Definition: jmAnimationCommon.h:363
void Pause()
Pause this player.
Definition: jmAnimationCommon.h:389
int GetStartPlayTimeOffset()
Returns the animation starting time point offset of this animation instance.
Definition: jmAnimationCommon.h:228
std::vector< Parameter > & GetParameters()
Returns a reference to the vector of stored parameters in this animation.
Definition: jmAnimationCommon.h:122
int loopCount
The number of loops.
Definition: jmAnimationCommon.h:80
The base animation class.
Definition: jmAnimationCommon.h:95
Animation * GetAnimation()
Returns the animation object of this animation instance.
Definition: jmAnimationCommon.h:195
Vec2< float > Vec2f
Vec2 struct in float precision.
Definition: jmCommon.h:167
int Update()
Update the player. This command must be called in every update loop of the game logic.
Definition: jmAnimationCommon.cpp:191
void SetStartPlayTimeOffset(int _startPlayTimeOffset)
Set the animation starting time point offset in milliseconds.
Definition: jmAnimationCommon.h:224
AnimationPlayerState
The states of animation player.
Definition: jmGlobal.h:178
bool loopForever
The animation loops forever.
Definition: jmAnimationCommon.h:81
AnimationBaseParameters & GetBaseParameters()
Returns the base animation parameters of this animation instance.
Definition: jmAnimationCommon.h:201
int Play(AnimationInstance *_animationInstance)
Play the given *_animationInstance*.
Definition: jmAnimationCommon.cpp:126
SourceSprite * GetSourceSprite()
Returns the source sprite to which this animation belongs.
Definition: jmAnimationCommon.h:110
AKMeta * GetActiveMetaKey()
Returns the active meta key of the played animation or nullptr if none.
Definition: jmAnimationCommon.h:285
int startDelay
The starting dealay of animation in milliseconds.
Definition: jmAnimationCommon.h:79
int Update(int msTimePoint, int _flags) override
Update the animation state for the given msTimePoint.
Definition: jmAnimationCommon.h:253
The animation base parameters of Animation objects.
Definition: jmAnimationCommon.h:76
int Stop()
Stop the played animation, clear the queue and put the player into the idle state.
Definition: jmAnimationCommon.cpp:460
int Play(AnimationInstance *_animationInstance, int _flags=0)
Play the given *_animationInstance*.
Definition: jmAnimationCommon.cpp:403
bool GetCompleteLoops()
Returns the completeLoops parameter of this animation instance.
Definition: jmAnimationCommon.h:211
AnimationPlayerState GetState()
Returns the state of this player.
Definition: jmAnimationCommon.h:371
bool repeat
The animation should repeats (if it doesn't loops forever).
Definition: jmAnimationCommon.h:82
The SourceSprite class defines the source sprite from JugiMap Editor.
Definition: jmSourceGraphics.h:221
void Resume()
Resume this player.
Definition: jmAnimationCommon.h:393
int GetCurrentAnimationTime()
Returns the current animation time in milliseconds.
Definition: jmAnimationCommon.h:277
The standard animation player for playing animations via AnimationInstance objects.
Definition: jmAnimationCommon.h:266
The DummyNoAnimationInstance is a special animation instance which can be used with animation players...
Definition: jmAnimationCommon.h:249
AnimationPlayer & GetPlayer()
Returns the wrapped AnimationPlayer object.
Definition: jmAnimationCommon.h:359
void Pause()
Pause this player.
Definition: jmAnimationCommon.cpp:315
AnimationKind
The kinds of animation. Used as identifier for Animation objects.
Definition: jmGlobal.h:145
The JugiMapBinaryLoader class loads data from jugimap binary files (.jmb).
Definition: jmMapBinaryLoader.h:37
void SetParametersForCompletingLoop()
This command modify the player parameters so that it will go into the AnimationPlayerState:STALLED st...
Definition: jmAnimationCommon.cpp:373
AnimationKind GetKind()
Returns the kind of this animation.
Definition: jmAnimationCommon.h:171
float GetSpeedFactor()
Returns the speed factor of this animation instance.
Definition: jmAnimationCommon.h:220
void SetCompleteLoops(bool _completeLoops)
Set a parameter which indicates that the animation should finish its current loop before ending.
Definition: jmAnimationCommon.h:207
ColorOverlayBlend
The blend modes for the shader based pixel blending which simulate photoshop blending modes.
Definition: jmGlobal.h:112
void Resume()
Resume this player.
Definition: jmAnimationCommon.cpp:332
void SetSpeedFactor(float _fSpeed)
Set the speed factor of animation playback. The value 1.0 is the default speed; higher values means f...
Definition: jmAnimationCommon.h:216
int Update()
Update the player. This command must be called in every update loop of the game logic.
Definition: jmAnimationCommon.cpp:476