ScummVM API documentation
animation.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef GRIM_ANIMATION_H
23 #define GRIM_ANIMATION_H
24 
25 #include "engines/grim/keyframe.h"
26 
27 namespace Grim {
28 
29 class SaveGame;
30 class AnimManager;
31 
32 class Animation {
33 public:
34  enum RepeatMode {
35  Once = 0,
36  Looping = 1,
37  PauseAtEnd = 2,
38  FadeAtEnd = 3
39  };
40  enum FadeMode {
41  None = 0,
42  FadeIn = 1,
43  FadeOut = 2
44  };
45 
46  Animation(const Common::String &keyframe, AnimManager *manager, int pr1, int pr2);
47  ~Animation();
48  void activate();
49  void deactivate();
50  void play(RepeatMode repeatMode);
51  void fade(FadeMode fadeMode, int fadeLength);
52  void pause(bool pause);
53  void stop();
54  bool getIsActive() const;
55  FadeMode getFadeMode() const;
56 
57  int update(uint time);
58 
59  void saveState(SaveGame *state) const;
60  void restoreState(SaveGame *state);
61 
62 private:
63  AnimManager *_manager;
64  ObjectPtr<KeyframeAnim> _keyframe;
65  int _priority1;
66  int _priority2;
67  bool _paused;
68  bool _active;
69  int _time;
70  float _fade;
71  RepeatMode _repeatMode;
72  FadeMode _fadeMode;
73  int _fadeLength;
74 
75  friend class AnimManager;
76 };
77 
78 class AnimManager {
79 public:
80  AnimManager();
81  ~AnimManager();
82  void addAnimation(Animation *anim, int pr1, int pr2);
83  void removeAnimation(const Animation *anim);
84 
85  void animate(ModelNode *hier, int numNodes);
86 
87 private:
88  struct AnimationEntry {
89  Animation *_anim;
90  int _priority;
91  bool _tagged;
92  };
93 
94  Common::List<AnimationEntry> _activeAnims;
95 };
96 
97 }
98 
99 #endif
Definition: animation.h:78
Definition: str.h:59
Definition: savegame.h:33
Definition: animation.h:32
Definition: actor.h:33
Definition: model.h:158
Definition: object.h:69