METHODS of the class
Method
void EventUpdate();
Description
Updates and manages events from the SDL2 library. Additionally, updates some of the library's subsystems, such as input device reading. Should be called once per cycle at the beginning of the frame.
Example
ngn->system->EventUpdate();
Method
std::string GetVersion();
Description
Returns a string with the current version of N'gine.
Example
std::string version = ngn->system->GetVersion();
Method
bool GetApplicationFocus();
Description
Returns whether the focus is on the application or not.
Example
bool focused = ngn->system->GetApplicationFocus();
Method
double GetFrameTime();
Description
Returns the total execution time of the last completed frame (in seconds). This value is calculated by measuring the difference between the start and the end of the frame processing using high-precision counters. It is essential for performance monitoring.
Example
double dt = ngn->system->GetFrameTime();
Method
float GetWorkLoad();
Description
Returns the workload percentage of the last processed frame. This value represents the ratio between the actual execution time and the maximum time available to maintain the target refresh rate. A value of 100% indicates that the frame consumed all its allotted time; higher values indicate that the engine cannot maintain the target frame rate (FPS).
Example
float cpu_usage = ngn->system->GetWorkLoad();
PROPERTIES of the class
Property
bool quit
Description
Class property. Takes the value TRUE if any SDL event requests the program to exit; otherwise, its value is FALSE.
Example
if (ngn->system->quit) exit_flag = true;
Property
bool fps_counter
Description
Class property. It has a default value of FALSE. If set to TRUE, it displays the frames per second being rendered in the debug console.
Example
ngn->system->fps_counter = true;