Crazy Eddies GUI System  0.7.2
CEGUIAffector.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 "CEGUIString.h"
34 #include "CEGUIKeyFrame.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
57 {
58 public:
61  {
64 
69 
73  AM_RelativeMultiply
74  };
75 
79  Affector(Animation* parent);
80 
82  ~Affector(void);
83 
92  void setApplicationMethod(ApplicationMethod method);
93 
101  ApplicationMethod getApplicationMethod() const;
102 
107  void setTargetProperty(const String& target);
108 
113  const String& getTargetProperty() const;
114 
122  void setInterpolator(Interpolator* interpolator);
123 
131  void setInterpolator(const String& name);
132 
137  Interpolator* getInterpolator() const;
138 
143  KeyFrame* createKeyFrame(float position);
144 
153  KeyFrame* createKeyFrame(float position, const String& value,
155  const String& sourceProperty = "");
156 
161  void destroyKeyFrame(KeyFrame* keyframe);
162 
167  KeyFrame* getKeyFrameAtPosition(float position) const;
168 
173  KeyFrame* getKeyFrameAtIdx(size_t index) const;
174 
179  size_t getNumKeyFrames() const;
180 
185  void moveKeyFrameToPosition(KeyFrame* keyframe, float newPosition);
186 
191  void moveKeyFrameToPosition(float oldPosition, float newPosition);
192 
202  void savePropertyValues(AnimationInstance* instance);
203 
216  void apply(AnimationInstance* instance);
217 
218 private:
220  Animation* d_parent;
222  ApplicationMethod d_applicationMethod;
224  String d_targetProperty;
226  Interpolator* d_interpolator;
227 
228  typedef std::map<float, KeyFrame*> KeyFrameMap;
232  KeyFrameMap d_keyFrames;
233 };
234 
235 } // End of CEGUI namespace section
236 
237 #if defined(_MSC_VER)
238 # pragma warning(pop)
239 #endif
240 
241 #endif // end of guard _CEGUIAffector_h_
242