Drag[en]gine Script Module DragonScript  1.23
Dragengine.Utils.Timer Class Reference

Timer triggered after a specific amount of time elapsed. More...

Inheritance diagram for Dragengine.Utils.Timer:
Dragengine.Gui.ClickedActionListener.ResetMultiClickTimer Dragengine.Gui.DisplayFPSRate.UpdateTimer Dragengine.Gui.MousePointers.VideoMousePointer.PlaybackTimer Dragengine.Gui.RepeatActionTimer Dragengine.Gui.ShoutConsole.UpdateTimer Dragengine.Gui.Widget.RepeatKeyEventTimer Dragengine.Utils.TimerBlock

Public Member Functions

void advance (float elapsed)
 Advance timer. More...
 
void fire ()
 Timer time elapsed. More...
 
float getElapsedTime ()
 Elapsed seconds. More...
 
bool getIsPeriodic ()
 Timer is periodic. More...
 
float getRemainingTime ()
 Remaining seconds until timer elapses. More...
 
TimerManager getTimerManager ()
 Timer manager the timer is registered at. More...
 
float getTriggerTime ()
 Seconds until timer elapsed. More...
 
void giveUp ()
 Give up timer if registered with a timer manager. More...
 
bool hasElapsed ()
 Timer elapsed. More...
 
Timer new (float triggerTime, bool periodic)
 Create timer registered at default timer manager. More...
 
Timer new (TimerManager manager, float triggerTime, bool periodic)
 Create timer registered at timer manager. More...
 
void setElapsedTime (float elapsedTime)
 Set elapsed seconds. More...
 
void setIsPeriodic (bool periodic)
 Set if timer is periodic. More...
 
void setTriggerTime (float triggerTime)
 Set seconds until timer elapses. More...
 

Public Attributes

float pElapsedTime
 
bool pIsPeriodic
 
TimerManager pTimerManager
 
float pTriggerTime
 

Detailed Description

Timer triggered after a specific amount of time elapsed.

Can be set as a trigger once timer which will remove itself after having fired or a trigger periodic timer which goes on triggering each time the given amount of time elapsed. A timer always registers with a TimerManager object. If no such object is specified during construction time the default timer manager is used which is a static timer manager.

Member Function Documentation

◆ advance()

void Dragengine.Utils.Timer.advance ( float  elapsed)

Advance timer.

If elapsed time reaches 0 fire() is called. If the timer is not periodic it is unregistered from timer manager. fire() is called after the timer has been removed. If timer is periodic the timer is rescheduled with the trigger time. This makes periodic timers not well suited for precise timing purpose at small update intervals. If you need this kind of precise timing use FrameUpdateListener and track elapsed time directly.

◆ fire()

◆ getElapsedTime()

float Dragengine.Utils.Timer.getElapsedTime ( )

Elapsed seconds.

◆ getIsPeriodic()

bool Dragengine.Utils.Timer.getIsPeriodic ( )

Timer is periodic.

◆ getRemainingTime()

float Dragengine.Utils.Timer.getRemainingTime ( )

Remaining seconds until timer elapses.

◆ getTimerManager()

TimerManager Dragengine.Utils.Timer.getTimerManager ( )

Timer manager the timer is registered at.

◆ getTriggerTime()

float Dragengine.Utils.Timer.getTriggerTime ( )

Seconds until timer elapsed.

◆ giveUp()

void Dragengine.Utils.Timer.giveUp ( )

Give up timer if registered with a timer manager.

Call to give up pending timer. Dropping the reference alone does not give up the timer.

Reimplemented in Dragengine.Utils.TimerBlock.

◆ hasElapsed()

bool Dragengine.Utils.Timer.hasElapsed ( )

Timer elapsed.

Version
1.21

Returns true if timer manager is null.

◆ new() [1/2]

Timer Dragengine.Utils.Timer.new ( float  triggerTime,
bool  periodic 
)

Create timer registered at default timer manager.

Parameters
triggerTimeSeconds to wait before triggering
periodicReschedule trigger once finished.

◆ new() [2/2]

Timer Dragengine.Utils.Timer.new ( TimerManager  manager,
float  triggerTime,
bool  periodic 
)

Create timer registered at timer manager.

Parameters
managerTimer Manager to register timer at
triggerTimeSeconds to wait before triggering
periodicTrue if this timer is periodic

◆ setElapsedTime()

void Dragengine.Utils.Timer.setElapsedTime ( float  elapsedTime)

Set elapsed seconds.

◆ setIsPeriodic()

void Dragengine.Utils.Timer.setIsPeriodic ( bool  periodic)

Set if timer is periodic.

◆ setTriggerTime()

void Dragengine.Utils.Timer.setTriggerTime ( float  triggerTime)

Set seconds until timer elapses.

Member Data Documentation

◆ pElapsedTime

float Dragengine.Utils.Timer.pElapsedTime

◆ pIsPeriodic

bool Dragengine.Utils.Timer.pIsPeriodic

◆ pTimerManager

TimerManager Dragengine.Utils.Timer.pTimerManager

◆ pTriggerTime

float Dragengine.Utils.Timer.pTriggerTime

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