#pragma once #include #include #include #include "../architecture/Plot_Render_Context.h" #include "../base/Color.h" #include "../base/Geometry.h" #include "../base/Text.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 scroll_track = Color{220, 220, 220}; Color scroll_thumb = Color{80, 80, 80}; }; 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; [[nodiscard]] std::shared_ptr display_snapshot() const; void set_options(Performance_Overlay_Options options); [[nodiscard]] Performance_Overlay_Options options() const; 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); private: Performance_Overlay_Private* d(); std::unique_ptr private_data; }; } // namespace renderive