Timer used for timer callbacks to instances of CGUIAnimatable. More...
#include <GUITimer.h>
Public Member Functions | |
void | AddAnimationCallback (eC_UInt uiTime, CGUIAnimatable *pkAnimatable) |
eC_UInt | GetIdleTime () |
eC_UInt | GetStepDuration () const |
eC_Bool | GetStepMode () const |
virtual eC_UInt | GetTime () |
eC_Bool | IsAnimating (const CGUIAnimatable *pkAnimatable) const |
void | NextTick () |
void | Process () |
void | RemoveAnimationCallback (CGUIAnimatable *pkAnimatable) |
void | SetStepDuration (const eC_UInt &uiStepDuration) |
void | SetStepMode (const eC_Bool &bStepMode) |
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 * | pkAnimatable | ||
) |
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). |
pkAnimatable | 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.
eC_UInt CGUITimer::GetStepDuration | ( | ) | const |
get the currently set step duration
eC_Bool CGUITimer::GetStepMode | ( | ) | const |
get currently set stepping mode
|
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 * | pkAnimatable | ) | const |
Checks whether an animation callback for a given animatable is registered
pkAnimatable | Pointer to animatable. |
void CGUITimer::NextTick | ( | ) |
advance the internal timer by the step duration
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 * | pkAnimatable | ) |
Removes all callbacks for the given animatable.
pkAnimatable | The animatable to be removed. |
void CGUITimer::SetStepDuration | ( | const eC_UInt & | uiStepDuration | ) |
set step duration when advancing with NextTick
uiStepDuration | number of milliseconds a single call to NextTick advances the timer |
void CGUITimer::SetStepMode | ( | const eC_Bool & | bStepMode | ) |
set stepping mode which will decouple the timer from the platform time
bStepMode | if true the timer will stop advancing until NextTick is called |
|
friend |