Guiliani  Version 2.5 revision 7293 (documentation build 13)
CGUIAnimation Class Referenceabstract

Base class for modular Guiliani animations. More...

#include <GUIAnimation.h>

Inheritance diagram for CGUIAnimation:

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 ()
 
CGUIObjectGetAnimatedObject () 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)
 
- Public Member Functions inherited from CGUIAnimatable
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 ()
 
- Public Member Functions inherited from CGUIStreamableObject
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 Public Attributes inherited from CGUIStreamableObject
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)
 
CGUIAnimatedAttributeGetAnimatedAttribute (const eC_UInt &uiAttributeIndex) const
 
virtual void OnStatusChanged (AnimationStatus_t eStatus)
 
void RemoveAnimatedAttributes ()
 
- Protected Member Functions inherited from CGUIStreamableObject
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
 

Detailed Description

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
  • shown immediately
  • dropped from above fast
  • dropped slowly from above
  • dropped from above but it will be bouncing like a rubber ball

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.

Note
When reading the GUI from stream, the ReadFromStream() method will not set its observer pointer. It is the responsibility of the animation observer to set itself as observer in the animation again when it is reading from stream.

Member Enumeration Documentation

◆ AnimationStatus_t

Status message which is used for the animation observer which is set with SetAnimationObserver().

Enumerator
ANIMATION_RUNNING 

The animation has just started running.

ANIMATION_PAUSED 

The animation has just been paused.

ANIMATION_STOPPED 

The animation has stopped. Either forcefully, or because it has ended.

ANIMATION_FINISHED 

The animation has reached its end, and does therefore finish animating.

ANIMATION_DELETED 

The animation has been deleted.

Constructor & Destructor Documentation

◆ ~CGUIAnimation()

virtual CGUIAnimation::~CGUIAnimation ( )
virtual

Destructor

◆ CGUIAnimation() [1/2]

CGUIAnimation::CGUIAnimation ( )
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.

◆ CGUIAnimation() [2/2]

CGUIAnimation::CGUIAnimation ( CGUIObject pkAnimatedObject,
eC_UInt  uiDuration,
eC_UInt  uiStepTime = 25,
eC_Bool  bDeletedAfterFinish = false 
)
protected

Constructor Adds the animation to the AnimationHandler.

Parameters
pkAnimatedObjectThe animated GUIObject. See GetAnimatedObject().
uiDurationThe duration of the animation in milliseconds.
uiStepTimeThe step time of each animation step in milliseconds. See GetStepTime().
bDeletedAfterFinishTrue if the animation shall be deleted after it was finished. (only for animations with a defined end).

Member Function Documentation

◆ AddAnimatedAttribute()

void CGUIAnimation::AddAnimatedAttribute ( CGUIAnimatedAttribute  kAnimatedAttribute)
protected

Adds a new animated attribute

Parameters
kAnimatedAttributenew animated attribute

◆ AddAnimationObserver()

void CGUIAnimation::AddAnimationObserver ( CGUIAnimationObserver pkObserver)
inline

Add the animation observer. The observer will be informed by calling CGUIAnimationObserver::OnStatusChanged, whenever the status of the animation changes.

Parameters
pkObserverThe observer of the animation.

◆ ApplyAnimation()

virtual void CGUIAnimation::ApplyAnimation ( eC_UInt  uiElapsedTime)
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()

Parameters
uiElapsedTimeTime elapsed (in ms) since start of animation.

Implemented in CGUIAnimationAttribute, CGUIAnimationBlinking, CGUIAnimationMove, CGUIAnimationMoveInOut, CGUIAnimationSize, CGUIAnimationStdGUIObject, and CGUIAnimationTrigger.

◆ ContinueAnimation()

void CGUIAnimation::ContinueAnimation ( )

Continue the animation. The timer callback will be restored (installed again).

◆ DoAnimate()

virtual void CGUIAnimation::DoAnimate ( const eC_Value &  vTimes = eC_FromInt(1))
virtual

Called by the GUITimer after the callback time expired. Calls ApplyAnimation().

Parameters
vTimesIgnored by base class, used by implemented animation to compensate for jitter

Reimplemented from CGUIAnimatable.

◆ GetAnimatedAttribute()

CGUIAnimatedAttribute & CGUIAnimation::GetAnimatedAttribute ( const eC_UInt &  uiAttributeIndex) const
protected

Get animated attribute for index

Parameters
uiAttributeIndexindex of attribute
Returns
Animated Attribute

◆ GetAnimatedAttributes()

eC_TListDoubleLinked< CGUIAnimatedAttribute > * CGUIAnimation::GetAnimatedAttributes ( )
inline

Gets all available animated attributes for this animation

Returns
list of all animated attributes

◆ GetAnimatedObject()

CGUIObject * CGUIAnimation::GetAnimatedObject ( ) const
inline
Returns
the animated GUIObject.

◆ GetAnimatedObjectID()

ObjectHandle_t CGUIAnimation::GetAnimatedObjectID ( ) const
inline
Returns
the objectID of the animated object

◆ GetDuration()

eC_UInt CGUIAnimation::GetDuration ( ) const
Returns
The total duration of the animation in milliseconds. If the animation has no defined end, the duration is 0.

◆ GetID()

eC_UInt CGUIAnimation::GetID ( ) const
inline
Returns
The unique id of the animation which is set when adding the animation to the CGUIAnimationHandler.

◆ GetStepTime()

eC_UInt CGUIAnimation::GetStepTime ( ) const
inline
Returns
The time for each animation step in milliseconds.

◆ InitAttributes()

virtual void CGUIAnimation::InitAttributes ( )
inlinevirtual

Called by StartAnimation(). Reimplement this method to initialize animation attributes before the animation is started if necessary.

Reimplemented in CGUIAnimationMove, and CGUIAnimationMoveInOut.

◆ IsDeletedAfterFinish()

eC_Bool CGUIAnimation::IsDeletedAfterFinish ( ) const
inline
Returns
True 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.

◆ IsPaused()

eC_Bool CGUIAnimation::IsPaused ( ) const
inline

Checks if the animation is currently paused.

Returns
True if an animation is currently paused

◆ OnStatusChanged()

virtual void CGUIAnimation::OnStatusChanged ( AnimationStatus_t  eStatus)
protectedvirtual

Called when the animation status changes. Informs the animation observer and removes the animation callback when the animation is no longer running.

Note
If overriding this function make sure that the base implementation is called to inform the observers.
Parameters
eStatusThe new status of the animation.

Reimplemented in CGUIAnimationAttribute, CGUIAnimationBlinking, CGUIAnimationMoveInOut, and CGUIAnimationTrigger.

◆ PauseAnimation()

void CGUIAnimation::PauseAnimation ( )

Pause the animation. The timer callback will be removed.

◆ ReadFromStream()

void CGUIAnimation::ReadFromStream ( )
virtual

Reads attributes from the streaming file. Only for use with GUIFactoryManager.

See also
CGUIObject::ReadFromStream()

Reimplemented from CGUIStreamableObject.

Reimplemented in CGUIAnimationAttribute, CGUIAnimationBlinking, CGUIAnimationMove, CGUIAnimationMoveInOut, CGUIAnimationSize, CGUIAnimationStdGUIObject, and CGUIAnimationTrigger.

◆ RemoveAnimatedAttributes()

void CGUIAnimation::RemoveAnimatedAttributes ( )
protected

Removes all animated attributes.

◆ RemoveAnimationObserver()

void CGUIAnimation::RemoveAnimationObserver ( CGUIAnimationObserver pkObserver)
inline

Removes given observer.

Parameters
pkObserverobserver

◆ SetAnimatedObject()

void CGUIAnimation::SetAnimatedObject ( CGUIObject pkObject)
inline

Set the animated object.

Parameters
pkObjectThe object which will be animated.

◆ SetAnimatedObjectID()

void CGUIAnimation::SetAnimatedObjectID ( const ObjectHandle_t eObject)
inline

Set the animated object.

Parameters
eObjectThe ObjectID

◆ SetAnimationObserver()

void CGUIAnimation::SetAnimationObserver ( CGUIAnimationObserver pkObserver)
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.

Parameters
pkObserverThe observer of the animation.

◆ SetDeletedAfterFinish()

void CGUIAnimation::SetDeletedAfterFinish ( const eC_Bool  bDeletedAfterFinish)
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.

Parameters
bDeletedAfterFinishIf True, delete the animation after is has finshed

◆ SetDuration()

void CGUIAnimation::SetDuration ( eC_UInt  uiDuration)

Set the duration for the Animation in milliseconds.

Parameters
uiDurationThe new duration time.

◆ StartAnimation()

void CGUIAnimation::StartAnimation ( )
virtual

Start the animation. This function registers a timer callback. ApplyAnimation() will be called after StepTime expired.

Reimplemented from CGUIAnimatable.

◆ StopAnimation()

void CGUIAnimation::StopAnimation ( )
virtual

Stop the animation. The timer callback will be removed.

Reimplemented from CGUIAnimatable.

◆ UpdateAnimatedObjectPointer()

void CGUIAnimation::UpdateAnimatedObjectPointer ( )

Checks if the animated object pointer is valid and updates it if necessary

◆ WriteToStream()

void CGUIAnimation::WriteToStream ( const eC_Bool  bWriteClassID = false)
virtual

Writes attributes to the streaming file. A CGUIStreamWriter has to be initialized.

Parameters
bWriteClassIDThis 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.

Friends And Related Function Documentation

◆ CGUIAnimationHandler

friend class CGUIAnimationHandler
friend

The documentation for this class was generated from the following file: