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
42namespace CEGUI
43{
44
64class CEGUIEXPORT Animation : public AllocatedObject<Animation>
65{
66public:
69 {
77 RM_Bounce
78 };
79
83 Animation(const String& name);
84
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
200 void defineAutoSubscription(const String& eventName, const String& action);
201
209 void undefineAutoSubscription(const String& eventName,
210 const String& action);
211
220
230
240
251
260 void apply(AnimationInstance* instance);
261
272 void writeXMLToStream(XMLSerializer& xml_stream, const String& name_override = "") const;
273
274private:
276 String d_name;
277
279 ReplayMode d_replayMode;
281 float d_duration;
285 bool d_autoStart;
286
287 typedef std::vector<Affector*
288 CEGUI_VECTOR_ALLOC(Affector*)> AffectorList;
290 AffectorList d_affectors;
291
292 typedef std::multimap<String, String, std::less<String>
293 CEGUI_MAP_ALLOC(String, String)> SubscriptionMap;
298 SubscriptionMap d_autoSubscriptions;
299};
300
301} // End of CEGUI namespace section
302
303#if defined(_MSC_VER)
304# pragma warning(pop)
305#endif
306
307#endif // end of guard _CEGUIAnimation_h_
308
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.
Affector * createAffector(const String &targetProperty, const String &interpolator)
Creates a new Affector.
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
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.
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.
Affector * getAffectorAtIdx(size_t index) const
Retrieves the Affector at given index.
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