MAGE  v0.171.0
Matthias Advanced Game Engine
mage::GameTimer Class Reference

#include <game_timer.hpp>

Public Member Functions

 GameTimer () noexcept=default
 
 GameTimer (const GameTimer &timer) noexcept=default
 
 GameTimer (GameTimer &&timer) noexcept=default
 
 ~GameTimer ()=default
 
GameTimeroperator= (const GameTimer &timer) noexcept=default
 
GameTimeroperator= (GameTimer &&timer) noexcept=default
 
void Start () noexcept
 
void Stop () noexcept
 
void Restart () noexcept
 
void Resume () noexcept
 
const GameTime GetTime () noexcept
 

Private Attributes

WallClockTimer m_wall_clock_timer
 
CPUTimer m_core_clock_timer
 

Detailed Description

A class of game timers.

Constructor & Destructor Documentation

◆ GameTimer() [1/3]

mage::GameTimer::GameTimer ( )
defaultnoexcept

Constructs a game timer.

◆ GameTimer() [2/3]

mage::GameTimer::GameTimer ( const GameTimer timer)
defaultnoexcept

Constructs a game timer from the given game timer.

Parameters
[in]timerA reference to the game timer to copy.

◆ GameTimer() [3/3]

mage::GameTimer::GameTimer ( GameTimer &&  timer)
defaultnoexcept

Constructs a game timer by moving the given game timer.

Parameters
[in]timerA reference to the game timer to move.

◆ ~GameTimer()

mage::GameTimer::~GameTimer ( )
default

Destructs this game timer.

Member Function Documentation

◆ GetTime()

const GameTime mage::GameTimer::GetTime ( )
noexcept

Returns the game time of this game timer.

Returns
The game time of this game timer.

◆ operator=() [1/2]

GameTimer& mage::GameTimer::operator= ( const GameTimer timer)
defaultnoexcept

Copies the given game timer to this game timer.

Parameters
[in]timerA reference to the game timer to copy.
Returns
A reference to the copy of the given game timer (i.e. this game timer).

◆ operator=() [2/2]

GameTimer& mage::GameTimer::operator= ( GameTimer &&  timer)
defaultnoexcept

Moves the given game timer to this game timer.

Parameters
[in]timerA reference to the game timer to move.
Returns
A reference to the moved game timer (i.e. this game timer).

◆ Restart()

void mage::GameTimer::Restart ( )
noexcept

Restarts this game timer.

◆ Resume()

void mage::GameTimer::Resume ( )
noexcept

Resumes this game timer.

◆ Start()

void mage::GameTimer::Start ( )
noexcept

Starts this game timer.

◆ Stop()

void mage::GameTimer::Stop ( )
noexcept

Stops this game timer.

Member Data Documentation

◆ m_core_clock_timer

CPUTimer mage::GameTimer::m_core_clock_timer
private

The core clock per core timer of this game timer.

◆ m_wall_clock_timer

WallClockTimer mage::GameTimer::m_wall_clock_timer
private

The wall clock timer of this game timer.