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 void | CreateInstance () |
static void | DeleteInstance () |
Friends | |
class | CGUIComponentManager |
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.
Example:
This example's widget would need to have an implementation of the CGUIAnimatable::DoAnimate() method:
For a more comprehensive example of a control with animations, please see Widget library.
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.
uiTime | The minimum amount of time that has to pass before the timer expires (milliseconds). |
pAnimatable | The animatable whose DoAnimate method is called when the timer expires. |
|
static |
Create Instance
|
static |
Delete Instance
eC_UInt CGUITimer::GetIdleTime | ( | ) |
Returns the time span in ms until the next animation timer expires.
|
virtual |
Returns the current 'Guiliani time'. Internally, this is mapped to a tick count and should therefore only be used for difference calculations.
eC_Bool CGUITimer::IsAnimating | ( | const CGUIAnimatable * | pAnimatable) | const |
Checks whether an animation callback for a given animatable is registered
pAnimatable | Pointer to animatable. |
void CGUITimer::Process | ( | ) |
Traverses the registered timer callbacks and executes an animatable's CGUIAnimatable::DoAnimate() method if its timer has expired.
void CGUITimer::RemoveAnimationCallback | ( | CGUIAnimatable * | pAnimatable) |
Removes all callbacks for the given animatable.
pAnimatable | The animatable to be removed. |
|
friend |