dEngine
Simple 2D C++ game engine
Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes | Static Private Attributes | List of all members
dengine::Time Class Reference

Time is used to help manage gametime, refresh rates, ticks and more. More...

#include <Time.h>

Public Member Functions

 Time ()
 
void StartTick ()
 Perform a tick at the beginning of the frame. More...
 
void EndTick ()
 Perform a tick at the end of the frame. More...
 

Static Public Member Functions

static Time & GetInstance ()
 Returns an instance to Time. More...
 

Public Attributes

float deltaTicks
 
float frameTicks
 The number of ticks per frame. More...
 

Private Attributes

Uint32 startTicks = 0
 
Uint32 endTicks = 0
 

Static Private Attributes

static Time instance
 

Detailed Description

Time is used to help manage gametime, refresh rates, ticks and more.

Constructor & Destructor Documentation

◆ Time()

Time::Time ( )

Member Function Documentation

◆ EndTick()

void Time::EndTick ( )

Perform a tick at the end of the frame.

To be run at the end of the frame, logs the end tick of the frame and calculates the framerate

Referenced by dengine::Game::loop(), and Time().

◆ GetInstance()

Time & Time::GetInstance ( )
static

Returns an instance to Time.

Referenced by dengine::Game::loop().

◆ StartTick()

void Time::StartTick ( )

Perform a tick at the beginning of the frame.

To be run at the beginning of a frame, logs the start tick of the frame

Referenced by dengine::Game::loop(), and Time().

Member Data Documentation

◆ deltaTicks

float dengine::Time::deltaTicks

Referenced by EndTick(), and Time().

◆ endTicks

Uint32 dengine::Time::endTicks = 0
private

Referenced by EndTick().

◆ frameTicks

float dengine::Time::frameTicks

The number of ticks per frame.

Referenced by EndTick(), and Time().

◆ instance

Time Time::instance
staticprivate

Referenced by GetInstance().

◆ startTicks

Uint32 dengine::Time::startTicks = 0
private

Referenced by EndTick(), and StartTick().