/** * @file rex/ui/overlay/debug_overlay.h * * @brief ImGui debug overlay dialog for frame timing display. * * @copyright Copyright (c) 2026 Tom Clay * All rights reserved. * * @license BSD 3-Clause License * See LICENSE file in the project root for full license text. */ #pragma once #include #include #include #include #include #include namespace rex::ui { struct FrameStats { double frame_time_ms = 0; double fps = 0; uint64_t frame_count = 0; }; class DebugOverlayDialog : public ImGuiDialog { public: using FrameStatsProvider = std::function; explicit DebugOverlayDialog(ImGuiDrawer* imgui_drawer, FrameStatsProvider stats_provider = {}, std::string_view build_stamp = {}); ~DebugOverlayDialog(); void SetStatsProvider(FrameStatsProvider provider) { stats_provider_ = std::move(provider); } protected: void OnDraw(ImGuiIO& io) override; private: FrameStatsProvider stats_provider_; std::string build_stamp_; #ifdef REXGLUE_ENABLE_PERF_COUNTERS static constexpr size_t kFrameHistorySize = 120; std::array frame_time_history_{}; size_t frame_history_idx_ = 0; #endif }; } // namespace rex::ui