Crazy Eddies GUI System 0.7.6
CEGUIAnimation.h
00001 /***********************************************************************
00002     filename:   CEGUIAnimation.h
00003     created:    7/8/2010
00004     author:     Martin Preisler
00005 
00006     purpose:    Defines the interface for the Animatin class
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 _CEGUIAnimation_h_
00031 #define _CEGUIAnimation_h_
00032 
00033 #include "CEGUIString.h"
00034 #include <vector>
00035 #include <map>
00036 
00037 #if defined(_MSC_VER)
00038 #   pragma warning(push)
00039 #   pragma warning(disable : 4251)
00040 #endif
00041 
00042 // Start of CEGUI namespace section
00043 namespace CEGUI
00044 {
00045 
00065 class CEGUIEXPORT Animation
00066 {
00067 public:
00069     enum ReplayMode
00070     {
00072         RM_Once,
00074         RM_Loop,
00078         RM_Bounce
00079     };
00080 
00084     Animation(const String& name);
00085 
00087     ~Animation(void);
00088 
00093     const String& getName() const;
00094 
00099     void setReplayMode(ReplayMode mode);
00100 
00105     ReplayMode getReplayMode() const;
00106 
00111     void setDuration(float duration);
00112 
00117     float getDuration() const;
00118 
00127     void setAutoStart(bool autoStart);
00128 
00136     bool getAutoStart() const;
00137 
00145     Affector* createAffector(void);
00146 
00154     Affector* createAffector(const String& targetProperty,
00155                              const String& interpolator);
00156 
00161     void destroyAffector(Affector* affector);
00162 
00167     Affector* getAffectorAtIdx(size_t index) const;
00168 
00173     size_t getNumAffectors(void) const;
00174 
00200     void defineAutoSubscription(const String& eventName, const String& action);
00201 
00209     void undefineAutoSubscription(const String& eventName,
00210                                   const String& action);
00211 
00219     void undefineAllAutoSubscriptions();
00220 
00229     void autoSubscribe(AnimationInstance* instance);
00230 
00239     void autoUnsubscribe(AnimationInstance* instance);
00240 
00250     void savePropertyValues(AnimationInstance* instance);
00251 
00260     void apply(AnimationInstance* instance);
00261 
00262 private:
00264     String d_name;
00265 
00267     ReplayMode d_replayMode;
00269     float d_duration;
00273     bool d_autoStart;
00274 
00275     typedef std::vector<Affector*> AffectorList;
00277     AffectorList d_affectors;
00278 
00279     typedef std::multimap<String, String> SubscriptionMap;
00284     SubscriptionMap d_autoSubscriptions;
00285 };
00286 
00287 } // End of  CEGUI namespace section
00288 
00289 #if defined(_MSC_VER)
00290 #   pragma warning(pop)
00291 #endif
00292 
00293 #endif  // end of guard _CEGUIAnimation_h_
00294