Crazy Eddies GUI System  0.7.8
CEGUIAnimation.h
1 /***********************************************************************
2  filename: CEGUIAnimation.h
3  created: 7/8/2010
4  author: Martin Preisler
5 
6  purpose: Defines the interface for the Animatin class
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 _CEGUIAnimation_h_
31 #define _CEGUIAnimation_h_
32 
33 #include "CEGUIString.h"
34 #include <vector>
35 #include <map>
36 
37 #if defined(_MSC_VER)
38 # pragma warning(push)
39 # pragma warning(disable : 4251)
40 #endif
41 
42 // Start of CEGUI namespace section
43 namespace CEGUI
44 {
45 
65 class CEGUIEXPORT Animation
66 {
67 public:
70  {
78  RM_Bounce
79  };
80 
84  Animation(const String& name);
85 
87  ~Animation(void);
88 
93  const String& getName() const;
94 
99  void setReplayMode(ReplayMode mode);
100 
105  ReplayMode getReplayMode() const;
106 
111  void setDuration(float duration);
112 
117  float getDuration() const;
118 
127  void setAutoStart(bool autoStart);
128 
136  bool getAutoStart() const;
137 
145  Affector* createAffector(void);
146 
154  Affector* createAffector(const String& targetProperty,
155  const String& interpolator);
156 
161  void destroyAffector(Affector* affector);
162 
167  Affector* getAffectorAtIdx(size_t index) const;
168 
173  size_t getNumAffectors(void) const;
174 
200  void defineAutoSubscription(const String& eventName, const String& action);
201 
209  void undefineAutoSubscription(const String& eventName,
210  const String& action);
211 
219  void undefineAllAutoSubscriptions();
220 
229  void autoSubscribe(AnimationInstance* instance);
230 
239  void autoUnsubscribe(AnimationInstance* instance);
240 
250  void savePropertyValues(AnimationInstance* instance);
251 
260  void apply(AnimationInstance* instance);
261 
262 private:
264  String d_name;
265 
267  ReplayMode d_replayMode;
269  float d_duration;
273  bool d_autoStart;
274 
275  typedef std::vector<Affector*> AffectorList;
277  AffectorList d_affectors;
278 
279  typedef std::multimap<String, String> SubscriptionMap;
284  SubscriptionMap d_autoSubscriptions;
285 };
286 
287 } // End of CEGUI namespace section
288 
289 #if defined(_MSC_VER)
290 # pragma warning(pop)
291 #endif
292 
293 #endif // end of guard _CEGUIAnimation_h_
294