Enigma  3.2.0
A Simple, Reliable and Efficient Encryption Tool
Application Class Referencefinal

#include <Application.hpp>

Inheritance diagram for Application:
SingleProcessInstance

Public Member Functions

 Application (const WindowSettings &window_settings=WindowSettings())
 
 ~Application () override
 
void Run ()
 
void Exit (const std::string &message, const std::int32_t exit_code) noexcept
 
void LaunchWorkerThread (Scene *scene, const std::string &loading_text, const std::function< void()> &work_func)
 Launches detached thread seperated from main UI thread. More...
 
const std::unique_ptr< Window > & GetWindow () const noexcept
 
void EndApplication () noexcept
 
void PushScene (std::unique_ptr< Scene > scene)
 
std::uint32_t GetFPS () const noexcept
 
float GetDeltaTime () const noexcept
 
constexpr const std::unique_ptr< RAMInfo > & GetRAMInfo () const noexcept
 
constexpr const std::unique_ptr< CPUInfo > & GetCPUInfo () const noexcept
 
void OnEvent (Event &event)
 Event callbacks. More...
 
bool OnWindowClose (WindowCloseEvent &event)
 
bool OnWindowResize (WindowResizeEvent &event)
 
bool OnFrameBufferResize (FrameBufferResizeEvent &event)
 
- Public Member Functions inherited from SingleProcessInstance
 SingleProcessInstance (const std::uint16_t port) noexcept
 
bool IsUnique () const noexcept
 
virtual ~SingleProcessInstance () noexcept
 

Static Public Member Functions

static ApplicationgetInstance () noexcept
 

Detailed Description

Definition at line 28 of file Application.hpp.

Constructor & Destructor Documentation

◆ Application()

Application::Application ( const WindowSettings window_settings = WindowSettings())
explicit

Application constructor

Parameters
window_settingsWindow settings struct to setup window's initial width, height, title...

◆ ~Application()

Application::~Application ( )
override

Member Function Documentation

◆ EndApplication()

void Application::EndApplication ( )
noexcept

Ends Application by exiting the main loop by setting window should close to true

◆ Exit()

void Application::Exit ( const std::string &  message,
const std::int32_t  exit_code 
)
noexcept

Immediate exit from application without waiting for GL flushes or scenes to be destroyed.

Parameters
messagereason of exiting
exit_codeexit code e.g EXIT_FAILURE

◆ GetCPUInfo()

constexpr const std::unique_ptr<CPUInfo>& Application::GetCPUInfo ( ) const
inlineconstexprnoexcept

Returns Realtime CPU usage informations (if enabled in WindowSettings.ini, otherwise nullptr)

Definition at line 92 of file Application.hpp.

◆ GetDeltaTime()

float Application::GetDeltaTime ( ) const
inlinenoexcept

Returns delta time value (the time difference between the previous frame the current frame)

Definition at line 86 of file Application.hpp.

◆ GetFPS()

std::uint32_t Application::GetFPS ( ) const
inlinenoexcept

Returns FPS (Frames Per Second) (if enabled in WindowSettings.ini, otherwise 0)

Definition at line 83 of file Application.hpp.

◆ getInstance()

static Application* Application::getInstance ( )
inlinestaticnoexcept

Returns the instance of this Application

Definition at line 69 of file Application.hpp.

◆ GetRAMInfo()

constexpr const std::unique_ptr<RAMInfo>& Application::GetRAMInfo ( ) const
inlineconstexprnoexcept

Returns Realtime RAM usage informations (if enabled in WindowSettings.ini, otherwise nullptr)

Definition at line 89 of file Application.hpp.

◆ GetWindow()

const std::unique_ptr<Window>& Application::GetWindow ( ) const
inlinenoexcept

Returns the Window of this Application

Definition at line 72 of file Application.hpp.

◆ LaunchWorkerThread()

void Application::LaunchWorkerThread ( Scene scene,
const std::string &  loading_text,
const std::function< void()> &  work_func 
)

Launches detached thread seperated from main UI thread.

Parameters
loading_textthe reason behind launching this worker thread, will appear bellow loading spinner e.g: "Encrypting file..."
scenepointer to scene which spawns the worker thread
work_funcfunction has work code to run in parallel

◆ OnEvent()

void Application::OnEvent ( Event event)

Event callbacks.

Parameters
eventevent that was dispatched
Returns
true if event is handled, false to pass it to other scenes
See also
Event.hpp

◆ OnFrameBufferResize()

bool Application::OnFrameBufferResize ( FrameBufferResizeEvent event)

◆ OnWindowClose()

bool Application::OnWindowClose ( WindowCloseEvent event)

◆ OnWindowResize()

bool Application::OnWindowResize ( WindowResizeEvent event)

◆ PushScene()

void Application::PushScene ( std::unique_ptr< Scene scene)

Pushes new Scene to the stack Calls scene life cycle OnCreate()

◆ Run()

void Application::Run ( )

Application Main Loop Runner


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