Guiliani  Version 2.4 revision 5970 (build 3)
CGUITimer Class Reference

Timer used for timer callbacks to instances of CGUIAnimatable. More...

#include <GUITimer.h>

Public Member Functions

void AddAnimationCallback (eC_UInt uiTime, CGUIAnimatable *pAnimatable)
eC_UInt GetIdleTime ()
virtual eC_UInt GetTime ()
eC_Bool IsAnimating (const CGUIAnimatable *pAnimatable) const
void Process ()
void RemoveAnimationCallback (CGUIAnimatable *pAnimatable)

Static Public Member Functions

static CGUITimerGetInstance ()

Detailed Description

Timer used for timer callbacks to instances of CGUIAnimatable.

This timer class is useful if you wish to initiate actions in certain (maybe cyclically repeating) time intervals. You may add a virtually unlimited number of timer-callbacks to the timer instance and whenever one of them expires, the registered animatable's CGUIAnimatable::DoAnimate() method is called.


// Create an instance of a custom control.
CMyAnimatedWidget* pkWidget = new CMyAnimatedWidget(eC_FromInt(0), eC_FromInt(0), eC_FromInt(100), eC_FromInt(100));
// Register the widget for a 500 ms callback.
GETTIMER.AddAnimationCallback(500, pkWidget);

This example's widget would need to have an implementation of the CGUIAnimatable::DoAnimate() method:

void CMyAnimatedWidget::DoAnimate(const eC_Value& vTimes)
InvalidateArea(); // Invalidate the old area covered by this object.
// ...
// Change this widget's size or position or other attributes.
// ...
InvalidateArea(); // Invalidate the new area as well if the object has been moved or resized.
if (some_condition)
GETTIMER.RemoveAnimationCallback(this); // End the animation if some_condition is true.

For a more comprehensive example of a control with animations, please see Widget library.

Member Function Documentation

◆ AddAnimationCallback()

void CGUITimer::AddAnimationCallback ( eC_UInt  uiTime,
CGUIAnimatable pAnimatable 

Adds a new callback to the list. If another callback for the same animatable exists, it will be updated with the new time.

uiTimeThe minimum amount of time that has to pass before the timer expires (milliseconds).
pAnimatableThe animatable whose DoAnimate method is called when the timer expires.

◆ GetIdleTime()

eC_UInt CGUITimer::GetIdleTime ( )

Returns the time span in ms until the next animation timer expires.

Time until the next timer expires (milliseconds).

◆ GetInstance()

static CGUITimer& CGUITimer::GetInstance ( )
pointer to the singleton timer instance.

◆ GetTime()

eC_UInt CGUITimer::GetTime ( )

Returns the current 'Guiliani time'. Internally, this is mapped to a tick count and should therefore only be used for difference calculations.

The current Guiliani time (milliseconds).

◆ IsAnimating()

eC_Bool CGUITimer::IsAnimating ( const CGUIAnimatable pAnimatable) const

Checks whether an animation callback for a given animatable is registered

pAnimatablePointer to animatable.
True if an animation callback for this animatable is currently registered, False otherwise

◆ Process()

void CGUITimer::Process ( )

Traverses the registered timer callbacks and executes an animatable's CGUIAnimatable::DoAnimate() method if its timer has expired.

◆ RemoveAnimationCallback()

void CGUITimer::RemoveAnimationCallback ( CGUIAnimatable pAnimatable)

Removes all callbacks for the given animatable.

pAnimatableThe animatable to be removed.

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