Potato Engine
Loading...
Searching...
No Matches
GameInstance Class Reference

Singleton with various game properties and functions. This class also manages game subobjects. More...

#include <GameInstance.hpp>

Inheritance diagram for GameInstance:
IEngineSubsystem

Public Member Functions

virtual void Resolve () noexcept override
void LoadSubobjects ()
WorldGetWorld () const
 Gets world object.
PlayerControllerGetPlayerController () const
 Gets player controller object.
void RequestShutdown ()
 Requests to queue engine shutdown.
Public Member Functions inherited from IEngineSubsystem
virtual void _BeginPlay ()

Static Public Member Functions

static GameInstanceget ()
 Gets singleton instance.

Public Attributes

bool _isMainTickRunning
float FRAMES_PER_SECOND
 Global FPS constant for screen refresh.
int MS_REPEAT_THRESHOLD
 Threshold to wait for input completion in milliseconds.

Detailed Description

Singleton with various game properties and functions. This class also manages game subobjects.

Set global constants and get objects using the instance.
Subclasses must be registered using SET_DEFAULT_SUBCLASS.

Definition at line 36 of file GameInstance.hpp.

Member Function Documentation

◆ get()

GameInstance * GameInstance::get ( )
static

Gets singleton instance.

Returns
instance

Definition at line 8 of file GameInstance.cpp.

◆ Resolve()

void GameInstance::Resolve ( )
overridevirtualnoexcept

Implements IEngineSubsystem.

Definition at line 51 of file GameInstance.cpp.

◆ LoadSubobjects()

void GameInstance::LoadSubobjects ( )

Definition at line 43 of file GameInstance.cpp.

◆ GetWorld()

World * GameInstance::GetWorld ( ) const

Gets world object.

Returns
World object

Definition at line 48 of file GameInstance.cpp.

◆ GetPlayerController()

PlayerController * GameInstance::GetPlayerController ( ) const

Gets player controller object.

Returns
player controller object

Definition at line 49 of file GameInstance.cpp.

◆ RequestShutdown()

void GameInstance::RequestShutdown ( )

Requests to queue engine shutdown.

Engine will be shutdown at the end of the current tick when this function is called

Definition at line 39 of file GameInstance.cpp.

Member Data Documentation

◆ _isMainTickRunning

bool GameInstance::_isMainTickRunning
Warning
NEVER MODIFY THIS VALUE DIRECTLY
See also
RequestShutdown()

Definition at line 63 of file GameInstance.hpp.

◆ FRAMES_PER_SECOND

float GameInstance::FRAMES_PER_SECOND

Global FPS constant for screen refresh.

Note
Reassignment after global BeginPlay has no affect on refresh rate

Definition at line 68 of file GameInstance.hpp.

◆ MS_REPEAT_THRESHOLD

int GameInstance::MS_REPEAT_THRESHOLD

Threshold to wait for input completion in milliseconds.

Terminal limitations make input states difficult to implement. A delay is used to wait for marking an input as complete. Higher values will make state based movement more smooth, but increase latency. Lower values will decrease smoothness but maximize input delay. A value of 195 is recommended for the optimal smoothness-to-latency ratio

Warning
A value of 0 will remove input state logic and minimize latency. However, inputs binded to states other than InputType::Triggered will never be fired
Note
This setting also affects boolean input latency (single button press).

Definition at line 79 of file GameInstance.hpp.