diff options
| author | hachem <im@hachem.wtf> | 2026-08-27 14:17:34 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-27 14:17:34 +0200 |
| commit | 705e3914e4e820c3ac92892c32c93479691a09e7 (patch) | |
| tree | bad8932559620328da060ea45245fcabec2332f2 /src/core | |
| parent | 90398614bcc9e1c1bde7a0f65a0db66173a1d8b4 (diff) | |
add: debugger interface
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/application.cpp | 13 | ||||
| -rw-r--r-- | src/core/application.h | 3 | ||||
| -rw-r--r-- | src/core/result.h | 18 |
3 files changed, 28 insertions, 6 deletions
diff --git a/src/core/application.cpp b/src/core/application.cpp index 7c2d9a3..1e6d343 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -4,6 +4,7 @@ #include "core/log.h" #include "core/window.h" #include "core/window_manager.h" +#include "debugger/debugger.h" #include <glad/gl.h> @@ -16,9 +17,6 @@ namespace Hsdbg using Clock = std::chrono::steady_clock; constexpr float MAX_DELTA_TIME = 0.25f; - - // a minimized window has no framebuffer to draw into, so idle instead of - // burning a core on frames nobody can see constexpr double MINIMIZED_WAIT_TIMEOUT = 0.1; } @@ -41,10 +39,14 @@ namespace Hsdbg window_spec.vsync = m_spec.vsync; m_window = &m_window_manager->create_window(window_spec); + + m_debugger = std::make_unique<Debugger>(); } Application::~Application() { + m_debugger.reset(); + m_window = nullptr; m_window_manager.reset(); @@ -103,15 +105,14 @@ namespace Hsdbg auto Application::update() -> void { + m_debugger->update(); } auto Application::render() -> void { - glViewport(0, - 0, + glViewport(0, 0, static_cast<GLsizei>(m_window->framebuffer_width()), static_cast<GLsizei>(m_window->framebuffer_height())); - glClearColor(0.09f, 0.09f, 0.11f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } diff --git a/src/core/application.h b/src/core/application.h index 8df5afb..2f5ffbe 100644 --- a/src/core/application.h +++ b/src/core/application.h @@ -6,6 +6,7 @@ namespace Hsdbg { + class Debugger; class Window; class WindowManager; @@ -34,6 +35,7 @@ namespace Hsdbg auto close() -> void; auto window() -> Window& { return *m_window; } + auto debugger() -> Debugger& { return *m_debugger; } 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; } @@ -48,6 +50,7 @@ namespace Hsdbg ApplicationSpec m_spec; std::unique_ptr<WindowManager> m_window_manager; + std::unique_ptr<Debugger> m_debugger; Window* m_window = nullptr; bool m_running = false; float m_delta_time = 0.0f; diff --git a/src/core/result.h b/src/core/result.h new file mode 100644 index 0000000..a516336 --- /dev/null +++ b/src/core/result.h @@ -0,0 +1,18 @@ +#pragma once + +#include <expected> +#include <format> +#include <string> +#include <utility> + +namespace Hsdbg +{ + template <typename T> + using Result = std::expected<T, std::string>; + + template <typename... Args> + auto fail(std::format_string<Args...> fmt, Args&&... args) -> std::unexpected<std::string> + { + return std::unexpected(std::format(fmt, std::forward<Args>(args)...)); + } +} |
