ScummVM API documentation
ParallelAnimation.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 // Based on code by omergilad.
23 
24 #ifndef GUI_ANIMATION_PARALLELANIMATION_H
25 #define GUI_ANIMATION_PARALLELANIMATION_H
26 
27 #include "gui/animation/Animation.h"
28 #include "common/array.h"
29 
30 namespace GUI {
31 
33 public:
35  virtual ~ParallelAnimation() {}
36 
37  virtual void addAnimation(AnimationPtr animation) {
38  _animations.push_back(animation);
39  }
40 
41  virtual void update(Drawable *drawable, long currentTime) {
42  for (AnimationPtr anim : _animations) {
43  anim->update(drawable, currentTime);
44  if (anim->isFinished()) {
45  finishAnimation();
46  }
47  }
48  }
49 
50  virtual void start(long currentTime) {
51  Animation::start(currentTime);
52 
53  for (AnimationPtr anim : _animations)
54  anim->start(currentTime);
55  }
56 
57  virtual void setDuration(long duration) {
58  Animation::setDuration(duration);
59 
60  for (AnimationPtr anim : _animations)
61  anim->setDuration(duration);
62  }
63 
64 private:
65 
66  Common::Array<AnimationPtr> _animations;
67 };
68 
69 } // End of namespace GUI
70 
71 #endif /* GUI_ANIMATION_PARALLELANIMATION_H */
virtual void start(long currentTime)
Definition: Animation.h:33
Definition: array.h:52
virtual void start(long currentTime)
Definition: ParallelAnimation.h:50
Definition: system.h:46
Definition: ParallelAnimation.h:32
virtual void setDuration(long duration)
Definition: ParallelAnimation.h:57
virtual void setDuration(long duration)
Definition: Drawable.h:37