Base class for modular Guiliani animations. More...
#include <GUIAnimation.h>
Public Types | |
enum | AnimationStatus_t { ANIMATION_RUNNING , ANIMATION_PAUSED , ANIMATION_STOPPED , ANIMATION_FINISHED , ANIMATION_DELETED } |
Public Member Functions | |
virtual | ~CGUIAnimation () |
void | AddAnimationObserver (CGUIAnimationObserver *pkObserver) |
virtual void | ApplyAnimation (eC_UInt uiElapsedTime)=0 |
void | ContinueAnimation () |
virtual void | DoAnimate (const eC_Value &vTimes=eC_FromInt(1)) |
eC_TListDoubleLinked< CGUIAnimatedAttribute > * | GetAnimatedAttributes () |
CGUIObject * | GetAnimatedObject () const |
ObjectHandle_t | GetAnimatedObjectID () const |
eC_UInt | GetDuration () const |
eC_UInt | GetID () const |
eC_UInt | GetStepTime () const |
virtual void | InitAttributes () |
eC_Bool | IsDeletedAfterFinish () const |
eC_Bool | IsPaused () const |
void | PauseAnimation () |
void | ReadFromStream () |
void | RemoveAnimationObserver (CGUIAnimationObserver *pkObserver) |
void | SetAnimatedObject (CGUIObject *pkObject) |
void | SetAnimatedObjectID (const ObjectHandle_t &eObject) |
void | SetAnimationObserver (CGUIAnimationObserver *pkObserver) |
void | SetDeletedAfterFinish (const eC_Bool bDeletedAfterFinish) |
void | SetDuration (eC_UInt uiDuration) |
void | StartAnimation () |
void | StopAnimation () |
void | UpdateAnimatedObjectPointer () |
void | WriteToStream (const eC_Bool bWriteClassID=false) |
![]() | |
virtual | ~CGUIAnimatable () |
Destructor. Removes all existing animation callbacks. | |
virtual void | DoAnimate (const eC_Value &vTimes=eC_FromInt(1)) |
virtual eC_Bool | IsAnimating () const |
virtual void | StartAnimation () |
virtual void | StopAnimation () |
![]() | |
const eC_String & | GetXMLTag () const |
virtual void | ReadFromStream () |
void | SetXMLTag (const eC_String &kXMLTag) |
virtual void | WriteToStream (const eC_Bool bWriteClassID=false) |
Static Public Attributes | |
static const eC_Char | XMLTAG_ANIMATIONCLASSID [] |
XML tag to be used when writing a animation class ID into a stream. | |
static const eC_Char | XMLTAG_ANIMATIONENDTAG [] |
XML tag to be used when finish writing CGUIAnimation information into the stream. | |
static const eC_Char | XMLTAG_ANIMATIONID [] |
XML tag to be used when writing a animation ID into a stream. | |
static const eC_Char | XMLTAG_ANIMATIONSTARTTAG [] |
XML tag to be used when start writing CGUIAnimation information into the stream. | |
![]() | |
static const eC_Char | XMLTAG_CLASSVERSION [] |
Protected Member Functions | |
CGUIAnimation () | |
CGUIAnimation (CGUIObject *pkAnimatedObject, eC_UInt uiDuration, eC_UInt uiStepTime=25, eC_Bool bDeletedAfterFinish=false) | |
void | AddAnimatedAttribute (CGUIAnimatedAttribute kAnimatedAttribute) |
CGUIAnimatedAttribute & | GetAnimatedAttribute (const eC_UInt &uiAttributeIndex) const |
virtual void | OnStatusChanged (AnimationStatus_t eStatus) |
void | RemoveAnimatedAttributes () |
![]() | |
eC_UInt | ReadStreamingHeader (const eC_UInt &uiClassVersion, const eC_UInt &uiClassMinVersion=0) const |
void | WriteStreamingFooter (const eC_Bool &bWriteClassID) const |
void | WriteStreamingHeader (const eC_Bool &bWriteClassID, const eC_Char *const pkClassIDTag, const eC_Int &iClassID, const eC_UInt &uiClassVersion) const |
Protected Attributes | |
eC_TListDoubleLinked< CGUIAnimatedAttribute > * | m_pkAnimatedAttributes |
available animated attributes | |
Friends | |
class | CGUIAnimationHandler |
Base class for modular Guiliani animations.
![]() | The "animations module" is providing standard animations for animation of objects. The object can appear in different ways: It can be
|
An animation object typically manipulates values of a GUIObject. After a specified step time, a timer event triggers the animation callback DoAnimate. GUIAnimations are using CGUIEasing functions to calculate the current attribute values.
DoAnimate triggers the CGUIEasing functions to recalculate the current value for attributes based on the elapsed time. Afterwards ApplyAnimation is called. This function reads the current values of the CGUIEasing functions and sets them in the animated object.
Basically there are two types of animations.
1. Animations with a specified duration. The CGUIEasing functions calculate the step size based on the duration, the StartValue and the TargetValue.
StepSize = (TargetValue - StartValue)/Duration;
2. Endless Animations. Endless animations do not have a defined end. They only have a step time after which DoAnimate is triggered. To have an endless animation the duration has to be set to 0. The CGUIEasing functions will calculate the step size for each animation step without using the duration.
StepSize = (TargetValue - StartValue);
It is possible to set an AnimationObserver which is informed whenever the status of the animation changes. Use the SetAnimationObserver() interface to register an observer.
Status message which is used for the animation observer which is set with SetAnimationObserver().
|
virtual |
Destructor
|
protected |
Default constructor for streaming. This constructor does not add the animation to the AnimationHandler since this is done after the AnimationHandler read the animation from stream.
|
protected |
Constructor Adds the animation to the AnimationHandler.
pkAnimatedObject | The animated GUIObject. See GetAnimatedObject(). |
uiDuration | The duration of the animation in milliseconds. |
uiStepTime | The step time of each animation step in milliseconds. See GetStepTime(). |
bDeletedAfterFinish | True if the animation shall be deleted after it was finished. (only for animations with a defined end). |
|
protected |
Adds a new animated attribute
kAnimatedAttribute | new animated attribute |
|
inline |
Add the animation observer. The observer will be informed by calling CGUIAnimationObserver::OnStatusChanged, whenever the status of the animation changes.
pkObserver | The observer of the animation. |
|
pure virtual |
This function contains the animation logic. It typically accesses the animation's CGUIEasing functions to get the current values and sets these values in the animated object. This function is called by DoAnimate()
uiElapsedTime | Time elapsed (in ms) since start of animation. |
Implemented in CGUIAnimationAttribute, CGUIAnimationBlinking, CGUIAnimationMove, CGUIAnimationMoveInOut, CGUIAnimationSize, CGUIAnimationStdGUIObject, and CGUIAnimationTrigger.
void CGUIAnimation::ContinueAnimation | ( | ) |
Continue the animation. The timer callback will be restored (installed again).
|
virtual |
Called by the GUITimer after the callback time expired. Calls ApplyAnimation().
vTimes | Ignored by base class, used by implemented animation to compensate for jitter |
Reimplemented from CGUIAnimatable.
|
protected |
Get animated attribute for index
uiAttributeIndex | index of attribute |
|
inline |
Gets all available animated attributes for this animation
|
inline |
|
inline |
eC_UInt CGUIAnimation::GetDuration | ( | ) | const |
|
inline |
|
inline |
|
inlinevirtual |
Called by StartAnimation(). Reimplement this method to initialize animation attributes before the animation is started if necessary.
Reimplemented in CGUIAnimationMove, and CGUIAnimationMoveInOut.
|
inline |
|
inline |
Checks if the animation is currently paused.
|
protectedvirtual |
Called when the animation status changes. Informs the animation observer and removes the animation callback when the animation is no longer running.
eStatus | The new status of the animation. |
Reimplemented in CGUIAnimationAttribute, CGUIAnimationBlinking, CGUIAnimationMoveInOut, and CGUIAnimationTrigger.
void CGUIAnimation::PauseAnimation | ( | ) |
Pause the animation. The timer callback will be removed.
|
virtual |
Reads attributes from the streaming file. Only for use with GUIFactoryManager.
Reimplemented from CGUIStreamableObject.
Reimplemented in CGUIAnimationAttribute, CGUIAnimationBlinking, CGUIAnimationMove, CGUIAnimationMoveInOut, CGUIAnimationSize, CGUIAnimationStdGUIObject, and CGUIAnimationTrigger.
|
protected |
Removes all animated attributes.
|
inline |
Removes given observer.
pkObserver | observer |
|
inline |
Set the animated object.
pkObject | The object which will be animated. |
|
inline |
Set the animated object.
eObject | The ObjectID |
|
inline |
Set the animation observer. All previous registered observer are removed. The observer will be informed by calling CGUIAnimationObserver::OnStatusChanged, whenever the status of the animation changes.
pkObserver | The observer of the animation. |
|
inline |
Specifies if this animation will be deleted once it is finished. This is only applicable for animations with a defined end. If no duration was set, the animation has no defined end.
bDeletedAfterFinish | If True, delete the animation after is has finshed |
void CGUIAnimation::SetDuration | ( | eC_UInt | uiDuration | ) |
Set the duration for the Animation in milliseconds.
uiDuration | The new duration time. |
|
virtual |
Start the animation. This function registers a timer callback. ApplyAnimation() will be called after StepTime expired.
Reimplemented from CGUIAnimatable.
|
virtual |
Stop the animation. The timer callback will be removed.
Reimplemented from CGUIAnimatable.
void CGUIAnimation::UpdateAnimatedObjectPointer | ( | ) |
Checks if the animated object pointer is valid and updates it if necessary
|
virtual |
Writes attributes to the streaming file. A CGUIStreamWriter has to be initialized.
bWriteClassID | This flag is used to switch writing of the class ID, leading and trailing tags. When implementing a new streamable object, check this flag. If it is true, first write the class ID, then continue with this object's attributes, and finally call the base class implementation with this flag set to false (this is the default). |
Reimplemented from CGUIStreamableObject.
Reimplemented in CGUIAnimationAttribute, CGUIAnimationBlinking, CGUIAnimationMove, CGUIAnimationMoveInOut, CGUIAnimationSize, CGUIAnimationStdGUIObject, and CGUIAnimationTrigger.
|
friend |