DEKI/ENGINE docs
manual api reference
Deki 0.40.1
Modular C++ engine with a visual editor, for 2D and 3D
Loading...
Searching...
No Matches

The engine's clock, independent of the platform. More...

#include <deki/Time.h>

Static Public Member Functions

static void Delay (uint32_t ms)
 Sleeps ms milliseconds through the delay function; does nothing when none is set.
static uint32_t GetDeltaTime ()
 Duration of the last frame in milliseconds.
static float GetDeltaTimeF ()
 Duration of the last frame in milliseconds, with sub-millisecond precision.
static uint32_t GetElapsed (uint32_t previousTime)
 Milliseconds since previousTime, a value from GetTime().
static float GetFPS ()
static uint32_t GetTime ()
 Milliseconds since Initialize().
static uint64_t GetTimeUs ()
 Microseconds on the platform's clock, for timing frames finer than a millisecond.
static void Initialize ()
 Call once at engine startup.
static void NoteTimeDrivenFrame ()
 Says the picture being rendered changes with time by itself (a shader reading the time), so a view that renders only when its scene changes, like the editor's Scene View, keeps rendering while it shows it.
static void ResetFrameTime ()
 Call after loading a scene, so the next frame's delta does not include the loading time.
static void SetDelayFunction (std::function< void(uint32_t)> fn)
 Sets the platform's sleep function.
static void SetTimeProvider (std::unique_ptr< ITimeProvider > provider)
 Sets the platform's time provider and takes ownership of it.
static bool TakeTimeDrivenFrame ()
 Whether NoteTimeDrivenFrame() was called since the last call; clears it.
static void Update (uint32_t deltaTime)
 Call once per frame with the frame's duration in milliseconds.
static void UpdateF (float deltaTimeMs)
 Update() with a float duration, for sub-millisecond precision (the editor's frame limiter).

Detailed Description

The engine's clock, independent of the platform.

All times are in milliseconds.

Member Function Documentation

◆ Delay()

void Deki::Time::Delay ( uint32_t ms)
static

Sleeps ms milliseconds through the delay function; does nothing when none is set.

◆ GetDeltaTime()

uint32_t Deki::Time::GetDeltaTime ( )
static

Duration of the last frame in milliseconds.

◆ GetDeltaTimeF()

float Deki::Time::GetDeltaTimeF ( )
static

Duration of the last frame in milliseconds, with sub-millisecond precision.

◆ GetElapsed()

uint32_t Deki::Time::GetElapsed ( uint32_t previousTime)
static

Milliseconds since previousTime, a value from GetTime().

◆ GetFPS()

float Deki::Time::GetFPS ( )
static

◆ GetTime()

uint32_t Deki::Time::GetTime ( )
static

Milliseconds since Initialize().

◆ GetTimeUs()

uint64_t Deki::Time::GetTimeUs ( )
static

Microseconds on the platform's clock, for timing frames finer than a millisecond.

Only differences between two readings mean anything.

◆ Initialize()

void Deki::Time::Initialize ( )
static

Call once at engine startup.

◆ NoteTimeDrivenFrame()

void Deki::Time::NoteTimeDrivenFrame ( )
static

Says the picture being rendered changes with time by itself (a shader reading the time), so a view that renders only when its scene changes, like the editor's Scene View, keeps rendering while it shows it.

◆ ResetFrameTime()

void Deki::Time::ResetFrameTime ( )
static

Call after loading a scene, so the next frame's delta does not include the loading time.

◆ SetDelayFunction()

void Deki::Time::SetDelayFunction ( std::function< void(uint32_t)> fn)
static

Sets the platform's sleep function.

Platform init calls it before RunMainLoop starts.

◆ SetTimeProvider()

void Deki::Time::SetTimeProvider ( std::unique_ptr< ITimeProvider > provider)
static

Sets the platform's time provider and takes ownership of it.

Call it before Initialize().

◆ TakeTimeDrivenFrame()

bool Deki::Time::TakeTimeDrivenFrame ( )
static

Whether NoteTimeDrivenFrame() was called since the last call; clears it.

◆ Update()

void Deki::Time::Update ( uint32_t deltaTime)
static

Call once per frame with the frame's duration in milliseconds.

◆ UpdateF()

void Deki::Time::UpdateF ( float deltaTimeMs)
static

Update() with a float duration, for sub-millisecond precision (the editor's frame limiter).


The documentation for this class was generated from the following file:
  • deki-engine/include/deki/Time.h