ge211  2021.5.1
A student game engine
Pausable_timer Class Reference

Detailed Description

A class for timing intervals while supporting pausing.

Definition at line 316 of file ge211_time.hxx.

+ Collaboration diagram for Pausable_timer:

Public Member Functions

 Pausable_timer (bool start_paused=false)
 Constructs a new pausable timer. More...
 
bool is_paused () const
 Checks whether the timer is currently paused.
 
Duration elapsed_time () const
 The elapsed time since the start or most recent reset, not counting paused times.
 
Duration pause ()
 Pauses the timer. More...
 
void resume ()
 Unpauses the timer. If the timer is already running, has no effect.
 
Duration reset ()
 Resets the timer, returning the elapsed time since starting or the most recent reset(). More...
 

Constructor & Destructor Documentation

◆ Pausable_timer()

Pausable_timer ( bool  start_paused = false)
inlineexplicit

Constructs a new pausable timer.

The timer is started running by default, but can be started paused by passing true.

Definition at line 321 of file ge211_time.hxx.

Member Function Documentation

◆ pause()

Duration pause ( )
inline

Pauses the timer.

If the timer is already paused, has no effect. In either case, the elapsed time thus far is saved, and can be queried with elapsed_time() const, or will continue to accumulate if we unpause().

Definition at line 353 of file ge211_time.hxx.

◆ reset()

Duration reset ( )
inline

Resets the timer, returning the elapsed time since starting or the most recent reset().

Leaves the pause state unchanged.

Definition at line 374 of file ge211_time.hxx.


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