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 
99 
105 
110  void setDuration(float duration);
111 
116  float getDuration() const;
117 
126  void setAutoStart(bool autoStart);
127 
135  bool getAutoStart() const;
136 
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 
219 
229 
239 
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 
Defines an 'affector' class.
Definition: Affector.h:56
Definition: MemoryAllocatedObject.h:110
Defines an 'animation instance' class.
Definition: AnimationInstance.h:75
Defines an 'animation' class.
Definition: Animation.h:65
Animation(const String &name)
void apply(AnimationInstance *instance)
Applies this Animation definition using information from given AnimationInstance.
void defineAutoSubscription(const String &eventName, const String &action)
This defined a new auto subscription.
void destroyAffector(Affector *affector)
Destroys given Affector.
ReplayMode getReplayMode() const
Retrieves the replay mode of this animation.
const String & getName() const
Retrieves name of this Animation definition.
Affector * createAffector(void)
Creates a new Affector.
~Animation(void)
destructor, this destroys all affectors defined inside this animation
Affector * createAffector(const String &targetProperty, const String &interpolator)
Creates a new Affector.
ReplayMode
enumerates possible replay modes
Definition: Animation.h:69
@ RM_Loop
loops the animation infinitely
Definition: Animation.h:73
@ RM_Once
plays the animation just once, then stops
Definition: Animation.h:71
void undefineAllAutoSubscriptions()
This undefines all previously defined auto subscriptions.
bool getAutoStart() const
Retrieves auto start.
void autoUnsubscribe(AnimationInstance *instance)
Unsubscribes all auto subscriptions with information from given animation instance.
Affector * getAffectorAtIdx(size_t index) const
Retrieves the Affector at given index.
void savePropertyValues(AnimationInstance *instance)
Internal method, causes all properties that are used by this animation and it's affectors to be saved...
void setReplayMode(ReplayMode mode)
Sets the replay mode of this animation.
void setAutoStart(bool autoStart)
Sets whether this animation auto starts or not.
void undefineAutoSubscription(const String &eventName, const String &action)
This undefines previously defined auto subscription.
void writeXMLToStream(XMLSerializer &xml_stream, const String &name_override="") const
Writes an xml representation of this Animation definition to out_stream.
void autoSubscribe(AnimationInstance *instance)
Subscribes all auto subscriptions with information from given animation instance.
float getDuration() const
Retrieves the duration of this animation.
void setDuration(float duration)
Sets the duration of this animation.
size_t getNumAffectors(void) const
Retrieves number of Affectors defined in this Animation.
String class used within the GUI system.
Definition: String.h:64
Class used to create XML Document.
Definition: XMLSerializer.h:87
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1