Fix configuration step
This commit is contained in:
@@ -17,7 +17,6 @@ public:
|
|||||||
Polygon() = default;
|
Polygon() = default;
|
||||||
~Polygon() = default;
|
~Polygon() = default;
|
||||||
|
|
||||||
void setup(cairo_t *context, const cairo_rectangle_t &rect) override;
|
|
||||||
void configure() override;
|
void configure() override;
|
||||||
int fps() const override;
|
int fps() const override;
|
||||||
void update() override;
|
void update() override;
|
||||||
@@ -25,7 +24,7 @@ public:
|
|||||||
std::string version() const override;
|
std::string version() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _num_points {10};
|
int _num_points {};
|
||||||
double _min_speed {0.2};
|
double _min_speed {0.2};
|
||||||
double _max_speed {2.0};
|
double _max_speed {2.0};
|
||||||
double _stroke_width {1.0};
|
double _stroke_width {1.0};
|
||||||
@@ -36,8 +35,13 @@ private:
|
|||||||
|
|
||||||
ScreensaverPlugin *create_instance() { return new Polygon; }
|
ScreensaverPlugin *create_instance() { return new Polygon; }
|
||||||
|
|
||||||
void Polygon::setup(cairo_t* context, const cairo_rectangle_t& rect) {
|
void Polygon::configure() {
|
||||||
ScreensaverPlugin::setup(context, rect);
|
_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) {
|
for (int i = 0; i < _num_points; ++i) {
|
||||||
Point p;
|
Point p;
|
||||||
p.x = sc::random::double_between(0, _r.width);
|
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"; }
|
std::string Polygon::version() const { return "1.0.0"; }
|
||||||
|
|
||||||
int Polygon::fps() const { return 30; }
|
int Polygon::fps() const { return 30; }
|
||||||
|
|||||||
Reference in New Issue
Block a user