SUNENGINE 0.0.2
A simple and bright C++ game engine.
 
Loading...
Searching...
No Matches
FreezeTime Class Reference

Manages the freezing and single frame stepping of the game time. More...

#include <FreezeTime.h>

Public Member Functions

 FreezeTime (const FreezeTime &)=delete
 
FreezeTimeoperator= (const FreezeTime &)=delete
 
float ComputeGameTime (float prev_time)
 Computes the game time, taking into account any frozen time.
 

Private Member Functions

bool HackedKeyRelease (AZUL_KEY k)
 Checks if a key has been released (private implementation).
 
void TestForFreezeKeys ()
 Tests for freeze keys and handles their input (private implementation).
 
DWORD GetRefreshRate ()
 Retrieves the refresh rate of the monitor.
 

Private Attributes

const float DEFAULT_FRAME_TIME
 Default frame time, adjusted to monitor's refresh rate.
 
float totalFrozenTime
 Total time the game has been frozen.
 
bool freeze_mode_active
 Indicates if freeze mode is active.
 

Static Private Attributes

static const AZUL_KEY FREEZE_KEY = AZUL_KEY::KEY_F10
 Key to toggle freeze mode.
 
static const AZUL_KEY SINGLE_FRAME_KEY = AZUL_KEY::KEY_F9
 Key to advance a single frame in freeze mode.
 
static const float DEAD_TIME_THRESHOLD = 0.1f
 Threshold for dead time.
 

Detailed Description

Manages the freezing and single frame stepping of the game time.

The FreezeTime class is responsible for managing the freezing and single frame stepping of the game time. It provides methods to compute the game time, handle key inputs for freezing, and manage the frozen time.

Member Function Documentation

◆ ComputeGameTime()

float FreezeTime::ComputeGameTime ( float prev_time)

Computes the game time, taking into account any frozen time.

Parameters
prev_timeThe previous game time.
Returns
The computed game time.
Here is the call graph for this function:

◆ GetRefreshRate()

DWORD FreezeTime::GetRefreshRate ( )
private

Retrieves the refresh rate of the monitor.

Returns
The refresh rate in Hz.

◆ HackedKeyRelease()

bool FreezeTime::HackedKeyRelease ( AZUL_KEY k)
private

Checks if a key has been released (private implementation).

Parameters
kThe key to check.
Returns
True if the key has been released, false otherwise.
Here is the caller graph for this function:

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