#pragma once #include #include #include #include #include "../architecture/Frame_Scheduler.h" #include "../base/Color.h" #include "../base/Geometry.h" #include "../base/Text.h" #include "../performance/Performance_Log_Record.h" #include "global.h" #include "Performance_Snapshot.h" namespace renderive { struct Performance_Overlay_Private; struct Performance_Overlay_Options { Font font; int top_margin = 4; int left_margin = 6; int right_margin = 12; int bottom_margin = 6; int scroll_bar_width = 8; int scroll_bar_margin = 2; Color background = Color::white(); Color foreground = Color::black(); Color section_color = Color{64, 142, 255}; Color label_color = Color{190, 190, 190}; Color value_color = Color{235, 218, 130}; Color unit_color = Color{150, 150, 150}; Color warning_color = Color{255, 96, 96}; Color muted_color = Color{95, 95, 95}; Color scroll_track = Color{220, 220, 220}; Color scroll_thumb = Color{80, 80, 80}; Performance_Log_Options log; }; class LIB_DECL Performance_Overlay : public Frame_Lifecycle_Observer { public: Performance_Overlay(); ~Performance_Overlay(); void set_enabled(bool enabled); bool enabled() const override; void collect_frame(std::shared_ptr frame) override; void collect_feedback_event(std::shared_ptr event) override; [[nodiscard]] std::shared_ptr display_snapshot() const; void set_options(Performance_Overlay_Options options); [[nodiscard]] Performance_Overlay_Options options() const; void set_log_options(Performance_Log_Options options); [[nodiscard]] Performance_Log_Options log_options() const; [[nodiscard]] bool logging_enabled() const; [[nodiscard]] bool capture_enabled() const override; void set_log_identity(Performance_Log_Plot_Identity identity); void set_font(Font font); void set_foreground(Color color); void set_background(Color color); void set_viewport(Size viewport, std::uint64_t version); bool handle_wheel(PointF position, double angle_delta_y, double pixel_delta_y); bool handle_pointer_press(PointF position); bool handle_pointer_move(PointF position); bool handle_pointer_release(PointF position); void set_update_callback(std::function callback); void set_clipboard_callback(std::function callback); private: Performance_Overlay_Private* d(); std::unique_ptr private_data; }; } // namespace renderive