Simulant  21.12-574
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
Public Member Functions | Static Public Member Functions | List of all members
smlt::TimeKeeper Class Reference
Inheritance diagram for smlt::TimeKeeper:
smlt::RefCounted< TimeKeeper > smlt::TwoPhaseConstructed

Public Member Functions

 TimeKeeper (const float fixed_step)
 
bool init () override
 
void clean_up () override
 
void update ()
 
float delta_time () const
 
float fixed_step () const
 
float fixed_step_remainder () const
 
float total_elapsed_seconds () const
 
float unscaled_delta_time () const
 
float unscaled_fixed_step () const
 
float time_scale () const
 
void set_time_scale (float value)
 
bool use_fixed_step ()
 
void restart ()
 

Static Public Member Functions

static uint64_t now_in_us ()
 
- Static Public Member Functions inherited from smlt::RefCounted< TimeKeeper >
static RefCounted< TimeKeeper >::ptr create (Args &&... args)
 
static RefCounted< TimeKeeper >::ptr create ()
 

Additional Inherited Members

- Public Types inherited from smlt::RefCounted< TimeKeeper >
typedef std::shared_ptr< TimeKeeperptr
 
typedef std::weak_ptr< TimeKeeperwptr
 
- Protected Member Functions inherited from smlt::RefCounted< TimeKeeper >
 RefCounted (Args &&...)
 

Member Function Documentation

◆ set_time_scale()

void smlt::TimeKeeper::set_time_scale ( float  value)

Scale deltatime and fixed step by a multiplier value. Setting this to 1.0 will return deltatime to normal, setting to zero will mean that deltatime and fixed_step will both return zero.

update will continue to be called even if time_scale == 0.0f fixed_update will stop being called, otherwise the accumulator would never decrease and it would run infinitely.


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