SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
DebugOverlay.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Core/OSDef.hpp>
5
6namespace Sleak {
7
8class GameBase;
9namespace RenderEngine { class Renderer; }
10
11/// Which panels DebugOverlay draws and how often it refreshes its metrics.
12/// @ingroup debug
14 bool ShowCameraPanel = true;
16 float PanelAlpha = 0.85f;
18};
19
20/// In-game ImGui panels showing camera state and performance metrics, built on UI.hpp.
21/// @ingroup debug
22class ENGINE_API DebugOverlay {
23public:
24 DebugOverlay() = default;
26
28 GameBase* game);
29 /// Refreshes cached metrics on the configured interval and draws the enabled panels.
30 void Render(float deltaTime);
31
32 void SetVisible(bool visible) { m_visible = visible; }
33 bool IsVisible() const { return m_visible; }
34 void ToggleVisible() { m_visible = !m_visible; }
35
36 DebugOverlayConfig& GetConfig() { return m_config; }
37
38private:
39 /// Draws position/rotation/mode readouts for the active camera.
40 void RenderCameraPanel();
41 /// Draws FPS, frame time, and renderer-specific stats.
42 void RenderPerformancePanel();
43
44 RenderEngine::Renderer* m_renderer = nullptr;
45 GameBase* m_game = nullptr;
46
47 bool m_visible = true;
48 bool m_showColliders = false;
49 DebugOverlayConfig m_config;
50
51 // Cached metrics
52 SystemMetricsData m_cachedMetrics;
53 float m_metricTimer = 0.0f;
54};
55
56} // namespace Sleak
DebugOverlay()=default
void SetVisible(bool visible)
bool IsVisible() const
void Initialize(RenderEngine::Renderer *renderer, GameBase *game)
void Render(float deltaTime)
Refreshes cached metrics on the configured interval and draws the enabled panels.
DebugOverlayConfig & GetConfig()
Abstract render backend: swapchain, frame lifecycle, and post-effect toggles.
Definition Renderer.hpp:37
Backend-facing rendering layer shared by the four graphics backends.
Root namespace for everything the engine exposes.
Definition Camera.hpp:10