hx3d  1
2D/3D Simple Game Framework
Public Member Functions | List of all members
hx3d::CallbackTimer Class Reference

Improved timer with callback execution. More...

#include <callback_timer.hpp>

Public Member Functions

 CallbackTimer ()
 Create an uninitialized callback timer. More...
 
 CallbackTimer (float delay, std::function< void()> function, bool loop=false)
 Create a callback timer using a delay and a function. The delay is in milliseconds. More...
 
void initialize (float delay, std::function< void()> function, bool loop=false)
 Initialize the timer. The delay is in milliseconds. More...
 
long remaining ()
 Get the remaining time in milliseconds. More...
 
void reset ()
 Reset the timer.
 
void update (float delta)
 Update the timer.
 
bool hasEnded ()
 Did the timer ended ? More...
 
bool isLooping ()
 Is the timer looping ? More...
 

Detailed Description

Improved timer with callback execution.

Definition at line 33 of file callback_timer.hpp.

Constructor & Destructor Documentation

hx3d::CallbackTimer::CallbackTimer ( )

Create an uninitialized callback timer.

See initialize.

Definition at line 25 of file callback_timer.cpp.

hx3d::CallbackTimer::CallbackTimer ( float  delay,
std::function< void()>  function,
bool  loop = false 
)

Create a callback timer using a delay and a function. The delay is in milliseconds.

Parameters
delayTimer delay
functionCallback
loopLoop ?

Definition at line 28 of file callback_timer.cpp.

Member Function Documentation

bool hx3d::CallbackTimer::hasEnded ( )

Did the timer ended ?

Returns
True/False

Definition at line 55 of file callback_timer.cpp.

void hx3d::CallbackTimer::initialize ( float  delay,
std::function< void()>  function,
bool  loop = false 
)

Initialize the timer. The delay is in milliseconds.

Parameters
delayTimer delay
functionCallback
loopLoop ?

Definition at line 31 of file callback_timer.cpp.

bool hx3d::CallbackTimer::isLooping ( )

Is the timer looping ?

Returns
True/False

Definition at line 63 of file callback_timer.cpp.

long hx3d::CallbackTimer::remaining ( )

Get the remaining time in milliseconds.

Returns
Remaining time

Definition at line 38 of file callback_timer.cpp.


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