/** * @file rex/ui/overlay/console_overlay.h * * @brief ImGui console overlay dialog for viewing captured log output. * * @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 #include #include #include namespace rex::ui { class ConsoleDialog : public ImGuiDialog { public: ConsoleDialog(ImGuiDrawer* imgui_drawer, std::shared_ptr sink); ~ConsoleDialog(); protected: void OnDraw(ImGuiIO& io) override; private: void ExecuteCommand(std::string_view cmd); void RefreshCategories(); static int InputTextCallback(ImGuiInputTextCallbackData* data); bool focus_input_next_frame_ = true; bool scroll_to_bottom_ = true; uint64_t last_generation_ = 0; std::shared_ptr sink_; std::vector entries_; // refreshed each frame when generation changes std::vector local_entries_; // console-only output (command feedback) // Filters int min_level_ = 0; // index into spdlog level enum; 0 = trace std::set known_categories_; std::map category_filter_; // category -> enabled // Command input char input_buf_[512] = {}; std::deque history_; int history_pos_ = -1; static constexpr size_t kMaxHistory = 32; }; } // namespace rex::ui