ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

animation.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef GRIM_ANIMATION_H
00024 #define GRIM_ANIMATION_H
00025 
00026 #include "engines/grim/keyframe.h"
00027 
00028 namespace Grim {
00029 
00030 class SaveGame;
00031 class AnimManager;
00032 
00033 class Animation {
00034 public:
00035     enum RepeatMode {
00036         Once = 0,
00037         Looping = 1,
00038         PauseAtEnd = 2,
00039         FadeAtEnd = 3
00040     };
00041     enum FadeMode {
00042         None = 0,
00043         FadeIn = 1,
00044         FadeOut = 2
00045     };
00046 
00047     Animation(const Common::String &keyframe, AnimManager *manager, int pr1, int pr2);
00048     ~Animation();
00049     void activate();
00050     void deactivate();
00051     void play(RepeatMode repeatMode);
00052     void fade(FadeMode fadeMode, int fadeLength);
00053     void pause(bool pause);
00054     void stop();
00055     bool getIsActive() const;
00056     FadeMode getFadeMode() const;
00057 
00058     int update(uint time);
00059 
00060     void saveState(SaveGame *state) const;
00061     void restoreState(SaveGame *state);
00062 
00063 private:
00064     AnimManager *_manager;
00065     ObjectPtr<KeyframeAnim> _keyframe;
00066     int _priority1;
00067     int _priority2;
00068     bool _paused;
00069     bool _active;
00070     int _time;
00071     float _fade;
00072     RepeatMode _repeatMode;
00073     FadeMode _fadeMode;
00074     int _fadeLength;
00075 
00076     friend class AnimManager;
00077 };
00078 
00079 class AnimManager {
00080 public:
00081     AnimManager();
00082     ~AnimManager();
00083     void addAnimation(Animation *anim, int pr1, int pr2);
00084     void removeAnimation(const Animation *anim);
00085 
00086     void animate(ModelNode *hier, int numNodes);
00087 
00088 private:
00089     struct AnimationEntry {
00090         Animation *_anim;
00091         int _priority;
00092         bool _tagged;
00093     };
00094 
00095     Common::List<AnimationEntry> _activeAnims;
00096 };
00097 
00098 }
00099 
00100 #endif


Generated on Sat Mar 16 2019 05:01:19 for ResidualVM by doxygen 1.7.1
curved edge   curved edge