Crazy Eddies GUI System  0.7.2
CEGUIAnimationManager.h
1 /***********************************************************************
2  filename: CEGUIAnimationManager.h
3  created: 7/8/2010
4  author: Martin Preisler
5 
6  purpose: Defines the interface for the AnimationManager object
7 *************************************************************************/
8 /***************************************************************************
9  * Copyright (C) 2004 - 2010 Paul D Turner & The CEGUI Development Team
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining
12  * a copy of this software and associated documentation files (the
13  * "Software"), to deal in the Software without restriction, including
14  * without limitation the rights to use, copy, modify, merge, publish,
15  * distribute, sublicense, and/or sell copies of the Software, and to
16  * permit persons to whom the Software is furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be
20  * included in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28  * OTHER DEALINGS IN THE SOFTWARE.
29  ***************************************************************************/
30 #ifndef _CEGUIAnimationManager_h_
31 #define _CEGUIAnimationManager_h_
32 
33 #include "CEGUISingleton.h"
34 #include "CEGUIString.h"
35 #include <map>
36 #include <vector>
37 
38 #if defined(_MSC_VER)
39 # pragma warning(push)
40 # pragma warning(disable : 4251)
41 #endif
42 
43 // Start of CEGUI namespace section
44 namespace CEGUI
45 {
46 
47 class CEGUIEXPORT AnimationManager : public Singleton <AnimationManager>
48 {
49 public:
50  /*************************************************************************
51  Construction and Destruction
52  *************************************************************************/
62  AnimationManager(void);
63 
64 
72  ~AnimationManager(void);
73 
85  void addInterpolator(Interpolator* interpolator);
86 
91  void removeInterpolator(Interpolator* interpolator);
92 
97  Interpolator* getInterpolator(const String& type) const;
98 
106  Animation* createAnimation(const String& name);
107 
112  void destroyAnimation(Animation* animation);
113 
118  void destroyAnimation(const String& name);
119 
124  Animation* getAnimation(const String& name) const;
125 
130  Animation* getAnimationAtIdx(size_t index) const;
131 
136  size_t getNumAnimations() const;
137 
145  AnimationInstance* instantiateAnimation(Animation* animation);
146 
154  AnimationInstance* instantiateAnimation(const String& name);
155 
160  void destroyAnimationInstance(AnimationInstance* instance);
161 
166  void destroyAllInstancesOfAnimation(Animation* animation);
167 
172  AnimationInstance* getAnimationInstanceAtIdx(size_t index) const;
173 
179  size_t getNumAnimationInstances() const;
180 
187  void stepInstances(float delta);
188 
201  void loadAnimationsFromXML(const String& filename,
202  const String& resourceGroup = "");
203 
212  static void setDefaultResourceGroup(const String& resourceGroup)
213  {
214  s_defaultResourceGroup = resourceGroup;
215  }
216 
226  static const String& getDefaultResourceGroup()
227  {
228  return s_defaultResourceGroup;
229  }
230 
231 private:
232  typedef std::map<String, Interpolator*> InterpolatorMap;
234  InterpolatorMap d_interpolators;
235  typedef std::vector<Interpolator*> BasicInterpolatorList;
237  BasicInterpolatorList d_basicInterpolators;
238 
239  typedef std::map<String, Animation*> AnimationMap;
241  AnimationMap d_animations;
242 
243  typedef std::multimap<Animation*, AnimationInstance*> AnimationInstanceMap;
245  AnimationInstanceMap d_animationInstances;
247  static const String s_xmlSchemaName;
249  static String s_defaultResourceGroup;
250 };
251 
252 } // End of CEGUI namespace section
253 
254 #if defined(_MSC_VER)
255 # pragma warning(pop)
256 #endif
257 
258 #endif // end of guard _CEGUIAnimationManager_h_
259