2 #ifndef ENIGMA_APPLICATION_H
3 #define ENIGMA_APPLICATION_H
16 #include <cpr/threadpool.h>
43 void Exit(
const std::string& message,
const std::int32_t exit_code) noexcept;
72 const std::unique_ptr<Window>&
GetWindow() const noexcept {
return m_window; }
83 std::uint32_t
GetFPS() const noexcept {
return m_FPS ? *m_FPS : 0u; }
89 constexpr
const std::unique_ptr<RAMInfo>&
GetRAMInfo() const noexcept {
return m_ram_info; }
92 constexpr
const std::unique_ptr<CPUInfo>&
GetCPUInfo() const noexcept {
return m_cpu_info; }
96 void UpdateDeltaTime() noexcept;
98 void UpdateHardwareInfo() noexcept;
105 void InitImGuiRenderer();
109 void InitImGuiFonts();
112 std::unique_ptr<
Window> m_window;
115 std::vector<std::unique_ptr<
Scene>> m_scenes;
116 std::unique_ptr<
Scene> m_loading_scene;
121 float m_last_frame_time;
122 float m_current_frame_time;
126 static constexpr
float HARWARE_INFO_UPDATE_TIME = 1.0f;
127 float m_hardware_info_timer;
128 std::unique_ptr<std::uint32_t> m_FPS;
129 std::unique_ptr<
RAMInfo> m_ram_info;
130 std::unique_ptr<
CPUInfo> m_cpu_info;
139 std::unique_ptr<cpr::ThreadPool> m_threadPool{};
#define NS_ENIGMA_BEGIN
Enable/Disable Assertions.
void OnEvent(Event &event)
Event callbacks.
const std::unique_ptr< Window > & GetWindow() const noexcept
Application(const WindowSettings &window_settings=WindowSettings())
std::uint32_t GetFPS() const noexcept
bool OnWindowResize(WindowResizeEvent &event)
void LaunchWorkerThread(Scene *scene, const std::string &loading_text, const std::function< void()> &work_func)
Launches detached thread seperated from main UI thread.
static Application * getInstance() noexcept
constexpr const std::unique_ptr< CPUInfo > & GetCPUInfo() const noexcept
bool OnWindowClose(WindowCloseEvent &event)
void Exit(const std::string &message, const std::int32_t exit_code) noexcept
void PushScene(std::unique_ptr< Scene > scene)
float GetDeltaTime() const noexcept
void EndApplication() noexcept
constexpr const std::unique_ptr< RAMInfo > & GetRAMInfo() const noexcept
bool OnFrameBufferResize(FrameBufferResizeEvent &event)
Single process instance class.