From 6e1ddf1b8661e347a9e4e3ae4e916c8785d53d5a Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Sun, 26 Oct 2025 23:09:09 +0100 Subject: [PATCH] Fix configuration step --- modules/Polygon/Polygon.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/modules/Polygon/Polygon.cpp b/modules/Polygon/Polygon.cpp index 70008d5..e3e7d3b 100644 --- a/modules/Polygon/Polygon.cpp +++ b/modules/Polygon/Polygon.cpp @@ -17,7 +17,6 @@ public: Polygon() = default; ~Polygon() = default; - void setup(cairo_t *context, const cairo_rectangle_t &rect) override; void configure() override; int fps() const override; void update() override; @@ -25,7 +24,7 @@ public: std::string version() const override; private: - int _num_points {10}; + int _num_points {}; double _min_speed {0.2}; double _max_speed {2.0}; double _stroke_width {1.0}; @@ -36,8 +35,13 @@ private: ScreensaverPlugin *create_instance() { return new Polygon; } -void Polygon::setup(cairo_t* context, const cairo_rectangle_t& rect) { - ScreensaverPlugin::setup(context, rect); +void Polygon::configure() { + _num_points = _j["num-points"]; + _min_speed = _j["min-speed"]; + _max_speed = _j["max-speed"]; + _stroke_width = _j["stroke-width"]; + _stroke_color = _j["stroke-color"]; + _fill_color = _j["fill-color"]; for (int i = 0; i < _num_points; ++i) { Point p; p.x = sc::random::double_between(0, _r.width); @@ -50,16 +54,6 @@ void Polygon::setup(cairo_t* context, const cairo_rectangle_t& rect) { } } -void Polygon::configure() { - _num_points = _j["num-points"]; - _min_speed = _j["min-speed"]; - _max_speed = _j["max-speed"]; - _stroke_width = _j["stroke-width"]; - _stroke_color = _j["stroke-color"]; - _fill_color = _j["fill-color"]; - setup(_c, _r); -} - std::string Polygon::version() const { return "1.0.0"; } int Polygon::fps() const { return 30; }