GAF Library
Generic Animation Format
 All Classes Functions Pages
GAFAnimation.h
1 #pragma once
2 
3 #ifndef __GAF_ANIMATION__
4 #define __GAF_ANIMATION__
5 
6 #define GAF_FIRST_FRAME_INDEX 0
7 
8 #include "GAFDelegates.h"
9 
10 class GAFAsset;
11 
12 enum AnimSetSequenceHint
13 {
14  ASSH_CONTINUE,
15  ASSH_RESTART
16 };
17 
18 
20 {
21 public:
22  ~GAFAnimation();
23  bool init(GAFAsset * anAnimationData);
24 
25  virtual void processAnimation();
26  virtual void start();
27  virtual void pauseAnimation();
28  virtual void resumeAnimation();
29  virtual void stop();
30  virtual void step();
32  bool isDone() const;
33  bool isAnimationRunning() const;
34  bool isLooped() const;
35  void setLooped(bool looped);
36  bool isReversed() const;
37  void setReversed(bool reversed);
38  int totalFrameCount() const;
39  int currentFrameIndex() const;
40 
41  bool setFrame(int index);
42 
44  bool gotoAndStop(const char * frameLabel);
45  bool gotoAndStop(int frameNumber);
46 
48  bool gotoAndPlay(const char * frameLabel);
49  bool gotoAndPlay(int frameNumber);
50 
51 
52  int getStartFrame(const char * frameLabel);
53  int getEndFrame(const char * frameLabel);
54 
60 
61  bool playSequence(const char * name, bool looped = false, bool resume = true, AnimSetSequenceHint hint = ASSH_RESTART);
62  void clearSequence();
63 
66 
69 
70  bool hasSequences() const;
71 protected:
72  GAFAnimation();
73 protected:
74  GAFAsset * _asset;
75  int _currentFrameIndex;
76 
77  void setAnimationRunning(bool value);
78  bool getIsRunning() const;
79 
80 private:
81  GAFSequenceDelegate * _sequenceDelegate;
82  GAFAnimationPlaybackDelegate* m_animationPlaybackDelegate;
83  int _totalFrameCount;
84  int _currentSequenceStart;
85  int _currentSequenceEnd;
86  bool _isRunning;
87  bool _isLooped;
88  bool _isReversed;
89 };
90 
91 
92 #endif // __GAF_ANIMATION__
Definition: GAFAsset.h:18
bool playSequence(const char *name, bool looped=false, bool resume=true, AnimSetSequenceHint hint=ASSH_RESTART)
Definition: GAFAnimation.cpp:308
Definition: GAFDelegates.h:13
void setSequenceDelegate(GAFSequenceDelegate *delegate)
Definition: GAFAnimation.cpp:26
bool isDone() const
Definition: GAFAnimation.cpp:150
bool gotoAndPlay(const char *frameLabel)
Plays animation from specified frame.
Definition: GAFAnimation.cpp:248
Definition: GAFDelegates.h:7
void setAnimationPlaybackDelegate(GAFAnimationPlaybackDelegate *delegate)
Definition: GAFAnimation.cpp:376
bool gotoAndStop(const char *frameLabel)
Plays specified frame and then stops.
Definition: GAFAnimation.cpp:228
Definition: GAFAnimation.h:19