Thanks to visit codestin.com
Credit goes to canreader.github.io
SleakEngine
1.0.0
C++23 multi-backend game engine
Toggle main menu visibility
Loading...
Searching...
No Matches
DebugOverlay.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
Core/OSDef.hpp
>
4
#include <
Debug/SystemMetrics.hpp
>
5
6
namespace
Sleak
{
7
8
class
GameBase
;
9
namespace
RenderEngine
{
class
Renderer
; }
10
11
/// Which panels DebugOverlay draws and how often it refreshes its metrics.
12
/// @ingroup debug
13
struct
DebugOverlayConfig
{
14
bool
ShowCameraPanel
=
true
;
15
bool
ShowPerformancePanel
=
true
;
16
float
PanelAlpha
= 0.85f;
17
float
MetricRefreshInterval
= 0.5f;
18
};
19
20
/// In-game ImGui panels showing camera state and performance metrics, built on UI.hpp.
21
/// @ingroup debug
22
class
ENGINE_API
DebugOverlay
{
23
public
:
24
DebugOverlay
() =
default
;
25
~DebugOverlay
();
26
27
void
Initialize
(
RenderEngine::Renderer
* renderer,
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
38
private
:
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
OSDef.hpp
SystemMetrics.hpp
Sleak::DebugOverlay::ToggleVisible
void ToggleVisible()
Definition
DebugOverlay.hpp:34
Sleak::DebugOverlay::DebugOverlay
DebugOverlay()=default
Sleak::DebugOverlay::SetVisible
void SetVisible(bool visible)
Definition
DebugOverlay.hpp:32
Sleak::DebugOverlay::IsVisible
bool IsVisible() const
Definition
DebugOverlay.hpp:33
Sleak::DebugOverlay::Initialize
void Initialize(RenderEngine::Renderer *renderer, GameBase *game)
Definition
DebugOverlay.cpp:17
Sleak::DebugOverlay::Render
void Render(float deltaTime)
Refreshes cached metrics on the configured interval and draws the enabled panels.
Definition
DebugOverlay.cpp:25
Sleak::DebugOverlay::GetConfig
DebugOverlayConfig & GetConfig()
Definition
DebugOverlay.hpp:36
Sleak::GameBase
Definition
GameBase.hpp:51
Sleak::RenderEngine::Renderer
Abstract render backend: swapchain, frame lifecycle, and post-effect toggles.
Definition
Renderer.hpp:37
Sleak::RenderEngine
Backend-facing rendering layer shared by the four graphics backends.
Definition
Application.hpp:60
Sleak
Root namespace for everything the engine exposes.
Definition
Camera.hpp:10
Sleak::DebugOverlayConfig
Definition
DebugOverlay.hpp:13
Sleak::DebugOverlayConfig::ShowCameraPanel
bool ShowCameraPanel
Definition
DebugOverlay.hpp:14
Sleak::DebugOverlayConfig::MetricRefreshInterval
float MetricRefreshInterval
Definition
DebugOverlay.hpp:17
Sleak::DebugOverlayConfig::PanelAlpha
float PanelAlpha
Definition
DebugOverlay.hpp:16
Sleak::DebugOverlayConfig::ShowPerformancePanel
bool ShowPerformancePanel
Definition
DebugOverlay.hpp:15
Sleak::SystemMetricsData
Definition
SystemMetrics.hpp:9
include
public
Debug
DebugOverlay.hpp
Generated on
for SleakEngine by
1.18.0