diff options
| author | hachem <im@hachem.wtf> | 2026-08-27 09:05:17 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-27 09:05:17 +0200 |
| commit | 4b64b2bd17433f427197af3679c9c8f5ad5ad1a4 (patch) | |
| tree | 7c22cd4fd1d4d3d1d69a8b992adae3e5e6f9e898 /src/core/application.h | |
| parent | bbe77bbbfbac0043a29d76817af0991996033f93 (diff) | |
add: application run loop + logging
Diffstat (limited to 'src/core/application.h')
| -rw-r--r-- | src/core/application.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/core/application.h b/src/core/application.h new file mode 100644 index 0000000..1e4a08d --- /dev/null +++ b/src/core/application.h @@ -0,0 +1,48 @@ +#pragma once + +#include <cstdint> +#include <string> + +namespace Hsdbg +{ + struct ApplicationSpec + { + std::string name = "hsdbg"; + uint32_t width = 1600; + uint32_t height = 900; + }; + + class Application + { + public: + explicit Application(const ApplicationSpec& spec); + ~Application(); + + Application(const Application&) = delete; + Application(Application&&) = delete; + auto operator=(const Application&) -> Application& = delete; + auto operator=(Application&&) -> Application& = delete; + + static auto get() -> Application&; + + auto run() -> void; + auto close() -> void; + + auto spec() const -> const ApplicationSpec& { return m_spec; } + auto is_running() const -> bool { return m_running; } + auto delta_time() const -> float { return m_delta_time; } + auto time() const -> float { return m_time; } + auto frame_count() const -> uint64_t { return m_frame_count; } + + private: + auto update() -> void; + + static Application* s_instance; + + ApplicationSpec m_spec; + bool m_running = false; + float m_delta_time = 0.0f; + float m_time = 0.0f; + uint64_t m_frame_count = 0; + }; +} |
