SDEngine
Game Engine
Loading...
Searching...
No Matches
EngineDebugLayer.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <deque>
4
7#include "SD/core/Layer.hpp"
9#include "SD/core/logging.hpp"
10#include "SD/export.hpp"
11
12namespace sd {
13
14struct Scene;
15struct View;
16
18 EngineDebugLayer(ApplicationRuntime runtime, EngineServices services, Scene* scene = nullptr);
19
20 void on_update(float dt);
21 void on_fixed_update(double dt);
22 void on_event(EventVariant& e);
23 void on_im_gui_menu_bar();
24 void on_gui_render();
25
26
27 void display_view_info(View* selected_view);
28 void display_scene_selector();
29 void display_ecs_inspector();
30 void display_event_log();
31 void display_layout_menu();
32 void display_save_layout_dialog();
33 void display_delete_layout_dialog();
34 void display_overwrite_confirmation_dialog();
35 void handle_layout_shortcuts();
36 void handle_debug_shortcuts();
37
39 return ApplicationRuntime{
40 .views = m_views,
41 .scenes = m_scenes,
42 .layout = m_layout,
43 .events = m_events,
44 .timer = m_frame_timer,
45 .global_layers = m_global_layers,
46 .hot_reload_enabled = m_hot_reload_enabled,
47 };
48 }
49
58
59 bool m_show_save_layout_dialog = false;
60 bool m_show_delete_layout_dialog = false;
61 bool m_show_overwrite_confirmation = false;
62 bool m_save_dialog_initialized = false;
64 std::array<char, 64> m_layout_name_buffer{};
65
66 bool m_show_view_inspector = true;
67 bool m_show_scene_inspector = true;
68 bool m_show_event_log = true;
69 bool m_show_renderer_info = true;
70 bool m_show_context_overlay = false;
71 void set_view_inspector_visible(bool visible) { m_show_view_inspector = visible; }
72 void set_scene_inspector_visible(bool visible) { m_show_scene_inspector = visible; }
73 void set_event_log_visible(bool visible) { m_show_event_log = visible; }
74 void set_renderer_info_visible(bool visible) { m_show_renderer_info = visible; }
75 void set_context_overlay_visible(bool visible) { m_show_context_overlay = visible; }
76
77 bool is_view_inspector_visible() const { return m_show_view_inspector; }
78 bool is_scene_inspector_visible() const { return m_show_scene_inspector; }
79 bool is_event_log_visible() const { return m_show_event_log; }
80 bool is_renderer_info_visible() const { return m_show_renderer_info; }
81 bool is_context_overlay_visible() const { return m_show_context_overlay; }
82
83 void apply_preset_configuration(bool inspectors_visible, bool log_visible, bool renderer_visible);
84
85 bool m_log_events = false;
86 bool m_log_scene_changes = false;
87 bool m_log_view_resizes = false;
88 bool m_log_entity_lifecycle = false;
89
90 char m_log_search_buffer[128]{};
91 bool m_log_show_trace = true;
92 bool m_log_show_debug = true;
93 bool m_log_show_info = true;
94 bool m_log_show_warn = true;
95 bool m_log_show_error = true;
96 bool m_log_show_critical = true;
97 bool m_log_show_general = true;
98 bool m_log_show_timestamps = true;
99
101 std::string name;
102 std::string full_path;
103 bool visible = true;
104 std::vector<CategoryNode> children;
105 };
106 CategoryNode m_category_root{"", "", true, {}};
107 bool m_category_tree_built = false;
108
109 void build_category_tree();
110 void render_category_node(CategoryNode& node);
111 void render_category_menu(CategoryNode& node);
112 bool is_log_visible(const std::string& category);
113 void set_category_visible(CategoryNode& node, bool visible);
114 bool is_log_entry_visible(const log::LogEntry& entry);
115
116 float m_timer = 0.0f;
117 int m_update_count = 0;
118 int m_fixed_update_count = 0;
119 int m_prev_fixed = 0;
120 int m_prev_update = 0;
121
122 Scene* m_selected_scene = nullptr;
123 std::optional<ViewId> m_selected_view_id;
124
125 Scene* m_prev_scene_for_entity_count = nullptr;
126 int m_prev_entity_count = -1;
127};
128
129} // namespace sd
Definition Application.hpp:22
Definition ApplicationRuntime.hpp:12
ViewManager & views
Definition ApplicationRuntime.hpp:13
Definition EngineDebugLayer.hpp:100
std::string full_path
Definition EngineDebugLayer.hpp:102
std::string name
Definition EngineDebugLayer.hpp:101
std::vector< CategoryNode > children
Definition EngineDebugLayer.hpp:104
Definition EngineDebugLayer.hpp:17
void set_renderer_info_visible(bool visible)
Definition EngineDebugLayer.hpp:74
void set_event_log_visible(bool visible)
Definition EngineDebugLayer.hpp:73
void set_context_overlay_visible(bool visible)
Definition EngineDebugLayer.hpp:75
void set_view_inspector_visible(bool visible)
Definition EngineDebugLayer.hpp:71
bool & m_hot_reload_enabled
Definition EngineDebugLayer.hpp:55
VulkanRenderer & m_renderer
Definition EngineDebugLayer.hpp:57
bool is_view_inspector_visible() const
Definition EngineDebugLayer.hpp:77
SceneManager & m_scenes
Definition EngineDebugLayer.hpp:51
bool is_scene_inspector_visible() const
Definition EngineDebugLayer.hpp:78
std::optional< ViewId > m_selected_view_id
Definition EngineDebugLayer.hpp:123
FrameTimer & m_frame_timer
Definition EngineDebugLayer.hpp:54
ViewManager & m_views
Definition EngineDebugLayer.hpp:50
LayoutManager & m_layout
Definition EngineDebugLayer.hpp:52
bool is_renderer_info_visible() const
Definition EngineDebugLayer.hpp:80
void set_scene_inspector_visible(bool visible)
Definition EngineDebugLayer.hpp:72
bool is_event_log_visible() const
Definition EngineDebugLayer.hpp:79
ApplicationRuntime make_runtime()
Definition EngineDebugLayer.hpp:38
EventManager & m_events
Definition EngineDebugLayer.hpp:53
std::string m_pending_layout_name
Definition EngineDebugLayer.hpp:63
bool is_context_overlay_visible() const
Definition EngineDebugLayer.hpp:81
LayerList & m_global_layers
Definition EngineDebugLayer.hpp:56
Definition EngineServices.hpp:10
Definition EventManager.hpp:12
Definition EventVariant.hpp:19
Tracks frame timing, fixed timestep accumulation, and CPU work time.
Definition FrameTimer.hpp:21
Definition LayerList.hpp:15
Manages window layouts using ImGui DockBuilder for presets and INI for user layouts.
Definition LayoutManager.hpp:14
Definition Layer.hpp:24
Definition SceneManager.hpp:14
Definition Scene.hpp:9
Definition ViewManager.hpp:21
Definition View.hpp:55
Definition VulkanRenderer.hpp:10
Definition logging.hpp:49
consteval U64 type_id_of()
Definition type_id.hpp:6