Crazy Eddie's GUI System  0.8.7
Animation.h
1 /***********************************************************************
2  created: 7/8/2010
3  author: Martin Preisler
4 
5  purpose: Defines the interface for the Animation class
6 *************************************************************************/
7 /***************************************************************************
8  * Copyright (C) 2004 - 2010 Paul D Turner & The CEGUI Development Team
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  ***************************************************************************/
29 #ifndef _CEGUIAnimation_h_
30 #define _CEGUIAnimation_h_
31 
32 #include "CEGUI/String.h"
33 #include <vector>
34 #include <map>
35 
36 #if defined(_MSC_VER)
37 # pragma warning(push)
38 # pragma warning(disable : 4251)
39 #endif
40 
41 // Start of CEGUI namespace section
42 namespace CEGUI
43 {
44 
64 class CEGUIEXPORT Animation : public AllocatedObject<Animation>
65 {
66 public:
69  {
77  RM_Bounce
78  };
79 
83  Animation(const String& name);
84 
86  ~Animation(void);
87 
92  const String& getName() const;
93 
98  void setReplayMode(ReplayMode mode);
99 
104  ReplayMode getReplayMode() const;
105 
110  void setDuration(float duration);
111 
116  float getDuration() const;
117 
126  void setAutoStart(bool autoStart);
127 
135  bool getAutoStart() const;
136 
144  Affector* createAffector(void);
145 
153  Affector* createAffector(const String& targetProperty,
154  const String& interpolator);
155 
160  void destroyAffector(Affector* affector);
161 
166  Affector* getAffectorAtIdx(size_t index) const;
167 
172  size_t getNumAffectors(void) const;
173 
199  void defineAutoSubscription(const String& eventName, const String& action);
200 
208  void undefineAutoSubscription(const String& eventName,
209  const String& action);
210 
218  void undefineAllAutoSubscriptions();
219 
228  void autoSubscribe(AnimationInstance* instance);
229 
238  void autoUnsubscribe(AnimationInstance* instance);
239 
249  void savePropertyValues(AnimationInstance* instance);
250 
259  void apply(AnimationInstance* instance);
260 
271  void writeXMLToStream(XMLSerializer& xml_stream, const String& name_override = "") const;
272 
273 private:
275  String d_name;
276 
278  ReplayMode d_replayMode;
280  float d_duration;
284  bool d_autoStart;
285 
286  typedef std::vector<Affector*
287  CEGUI_VECTOR_ALLOC(Affector*)> AffectorList;
289  AffectorList d_affectors;
290 
291  typedef std::multimap<String, String, std::less<String>
292  CEGUI_MAP_ALLOC(String, String)> SubscriptionMap;
297  SubscriptionMap d_autoSubscriptions;
298 };
299 
300 } // End of CEGUI namespace section
301 
302 #if defined(_MSC_VER)
303 # pragma warning(pop)
304 #endif
305 
306 #endif // end of guard _CEGUIAnimation_h_
307 
plays the animation just once, then stops
Definition: Animation.h:71
Definition: MemoryAllocatedObject.h:109
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
Defines an 'animation' class.
Definition: Animation.h:64
Defines an 'affector' class.
Definition: Affector.h:55
ReplayMode
enumerates possible replay modes
Definition: Animation.h:68
Class used to create XML Document.
Definition: XMLSerializer.h:85
Defines an 'animation instance' class.
Definition: AnimationInstance.h:73
loops the animation infinitely
Definition: Animation.h:73
String class used within the GUI system.
Definition: String.h:62