Crazy Eddies GUI System
0.7.6
|
00001 /*********************************************************************** 00002 filename: CEGUIAnimationManager.h 00003 created: 7/8/2010 00004 author: Martin Preisler 00005 00006 purpose: Defines the interface for the AnimationManager object 00007 *************************************************************************/ 00008 /*************************************************************************** 00009 * Copyright (C) 2004 - 2010 Paul D Turner & The CEGUI Development Team 00010 * 00011 * Permission is hereby granted, free of charge, to any person obtaining 00012 * a copy of this software and associated documentation files (the 00013 * "Software"), to deal in the Software without restriction, including 00014 * without limitation the rights to use, copy, modify, merge, publish, 00015 * distribute, sublicense, and/or sell copies of the Software, and to 00016 * permit persons to whom the Software is furnished to do so, subject to 00017 * the following conditions: 00018 * 00019 * The above copyright notice and this permission notice shall be 00020 * included in all copies or substantial portions of the Software. 00021 * 00022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00023 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00024 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00025 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00026 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00027 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00028 * OTHER DEALINGS IN THE SOFTWARE. 00029 ***************************************************************************/ 00030 #ifndef _CEGUIAnimationManager_h_ 00031 #define _CEGUIAnimationManager_h_ 00032 00033 #include "CEGUISingleton.h" 00034 #include "CEGUIString.h" 00035 #include <map> 00036 #include <vector> 00037 00038 #if defined(_MSC_VER) 00039 # pragma warning(push) 00040 # pragma warning(disable : 4251) 00041 #endif 00042 00043 // Start of CEGUI namespace section 00044 namespace CEGUI 00045 { 00046 00047 class CEGUIEXPORT AnimationManager : public Singleton <AnimationManager> 00048 { 00049 public: 00050 /************************************************************************* 00051 Construction and Destruction 00052 *************************************************************************/ 00062 AnimationManager(void); 00063 00064 00072 ~AnimationManager(void); 00073 00085 void addInterpolator(Interpolator* interpolator); 00086 00091 void removeInterpolator(Interpolator* interpolator); 00092 00097 Interpolator* getInterpolator(const String& type) const; 00098 00106 Animation* createAnimation(const String& name = ""); 00107 00112 void destroyAnimation(Animation* animation); 00113 00118 void destroyAnimation(const String& name); 00119 00124 Animation* getAnimation(const String& name) const; 00125 00130 Animation* getAnimationAtIdx(size_t index) const; 00131 00136 size_t getNumAnimations() const; 00137 00145 AnimationInstance* instantiateAnimation(Animation* animation); 00146 00154 AnimationInstance* instantiateAnimation(const String& name); 00155 00160 void destroyAnimationInstance(AnimationInstance* instance); 00161 00166 void destroyAllInstancesOfAnimation(Animation* animation); 00167 00172 AnimationInstance* getAnimationInstanceAtIdx(size_t index) const; 00173 00179 size_t getNumAnimationInstances() const; 00180 00187 void stepInstances(float delta); 00188 00201 void loadAnimationsFromXML(const String& filename, 00202 const String& resourceGroup = ""); 00203 00212 static void setDefaultResourceGroup(const String& resourceGroup) 00213 { 00214 s_defaultResourceGroup = resourceGroup; 00215 } 00216 00226 static const String& getDefaultResourceGroup() 00227 { 00228 return s_defaultResourceGroup; 00229 } 00230 00242 bool isAnimationPresent(const String& name) const; 00243 00244 private: 00245 String generateUniqueAnimationName(); 00246 00247 typedef std::map<String, Interpolator*> InterpolatorMap; 00249 InterpolatorMap d_interpolators; 00250 typedef std::vector<Interpolator*> BasicInterpolatorList; 00252 BasicInterpolatorList d_basicInterpolators; 00253 00254 typedef std::map<String, Animation*> AnimationMap; 00256 AnimationMap d_animations; 00257 00258 typedef std::multimap<Animation*, AnimationInstance*> AnimationInstanceMap; 00260 AnimationInstanceMap d_animationInstances; 00262 static const String s_xmlSchemaName; 00264 static String s_defaultResourceGroup; 00266 static const String GeneratedAnimationNameBase; 00268 unsigned long d_uid_counter; 00269 }; 00270 00271 } // End of CEGUI namespace section 00272 00273 #if defined(_MSC_VER) 00274 # pragma warning(pop) 00275 #endif 00276 00277 #endif // end of guard _CEGUIAnimationManager_h_ 00278