Lysa  0.0
Lysa 3D Engine
Timers Class Reference

Detailed Description

Registry and factory for Timer objects.

Public Member Functions

virtual ~Timers ()
 
void cleanup ()
 
std::shared_ptr< TimerregisterTimer (const std::shared_ptr< Timer > &timer)
 
std::shared_ptr< Timercreate (float waitTime, const Timer::Callback &callback, bool oneShot=true, bool autoStart=true)
 
void update (double deltaTime)
 

Constructor & Destructor Documentation

virtual ~Timers ( )
virtual

Stops every timer still registered.

Member Function Documentation

void cleanup ( )
std::shared_ptr<Timer> create ( float  waitTime,
const Timer::Callback callback,
bool  oneShot = true,
bool  autoStart = true 
)

Creates a Timer with a C++ callback, registers it, and returns it.

Parameters
waitTimeDelay in seconds.
callbackCallback.
oneShotStop after first timeout?
autoStartStart immediately?
std::shared_ptr<Timer> registerTimer ( const std::shared_ptr< Timer > &  timer)

Registers an existing Timer and returns it. The timer is removed automatically once it stops.

void update ( double  deltaTime)

Advances all registered timers; removes stopped ones.