Crazy Eddie's GUI System  0.8.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Affector.h
1 /***********************************************************************
2  filename: CEGUIAffector.h
3  created: 7/8/2010
4  author: Martin Preisler
5 
6  purpose: Defines the interface for the Affector clas
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 _CEGUIAffector_h_
31 #define _CEGUIAffector_h_
32 
33 #include "CEGUI/String.h"
34 #include "CEGUI/KeyFrame.h"
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 
56 class CEGUIEXPORT Affector : public AllocatedObject<Affector>
57 {
58 public:
61  {
64 
69 
73  AM_RelativeMultiply
74  };
75 
79  Affector(Animation* parent);
80 
82  ~Affector(void);
83 
88  inline Animation* getParent() const
89  {
90  return d_parent;
91  }
92 
100  size_t getIdxInParent() const;
101 
110  void setApplicationMethod(ApplicationMethod method);
111 
119  ApplicationMethod getApplicationMethod() const;
120 
125  void setTargetProperty(const String& target);
126 
131  const String& getTargetProperty() const;
132 
140  void setInterpolator(Interpolator* interpolator);
141 
149  void setInterpolator(const String& name);
150 
155  Interpolator* getInterpolator() const;
156 
161  KeyFrame* createKeyFrame(float position);
162 
171  KeyFrame* createKeyFrame(float position, const String& value,
173  const String& sourceProperty = "");
174 
179  void destroyKeyFrame(KeyFrame* keyframe);
180 
185  KeyFrame* getKeyFrameAtPosition(float position) const;
186 
191  bool hasKeyFrameAtPosition(float position) const;
192 
197  KeyFrame* getKeyFrameAtIdx(size_t index) const;
198 
203  size_t getNumKeyFrames() const;
204 
209  void moveKeyFrameToPosition(KeyFrame* keyframe, float newPosition);
210 
215  void moveKeyFrameToPosition(float oldPosition, float newPosition);
216 
226  void savePropertyValues(AnimationInstance* instance);
227 
240  void apply(AnimationInstance* instance);
241 
249  void writeXMLToStream(XMLSerializer& xml_stream) const;
250 
251 private:
253  Animation* d_parent;
255  ApplicationMethod d_applicationMethod;
257  String d_targetProperty;
259  Interpolator* d_interpolator;
260 
261  typedef std::map<float, KeyFrame*, std::less<float>
262  CEGUI_MAP_ALLOC(float, KeyFrame*)> KeyFrameMap;
266  KeyFrameMap d_keyFrames;
267 };
268 
269 } // End of CEGUI namespace section
270 
271 #if defined(_MSC_VER)
272 # pragma warning(pop)
273 #endif
274 
275 #endif // end of guard _CEGUIAffector_h_
276