diff --git a/src/ScreensaverPlugin.cpp b/src/ScreensaverPlugin.cpp index 2d5de93..950f75d 100644 --- a/src/ScreensaverPlugin.cpp +++ b/src/ScreensaverPlugin.cpp @@ -94,3 +94,17 @@ void ScreensaverPlugin::rounded_rect(const cairo_rectangle_t& rect, double radiu cairo_line_to(_c, x0, y1); cairo_arc(_c, x1, y1, radius, M_PI, 1.5 * M_PI); } + +void ScreensaverPlugin::config(const nlohmann::json& data) { + _j = data; + configure(); +} + +void ScreensaverPlugin::config(nlohmann::json&& data) { + _j = data; + configure(); +} + +void ScreensaverPlugin::configure() { + // empty default implementation +} diff --git a/src/ScreensaverPlugin.hpp b/src/ScreensaverPlugin.hpp index 148c960..ddd761a 100644 --- a/src/ScreensaverPlugin.hpp +++ b/src/ScreensaverPlugin.hpp @@ -18,13 +18,14 @@ class ScreensaverPlugin { virtual ~ScreensaverPlugin() = default; virtual void setup(cairo_t* context, const cairo_rectangle_t& rect); + virtual void configure(); virtual int fps() const; virtual void update() = 0; // advance state for next frame virtual void render() = 0; // draw next frame - void config(const nlohmann::json& data) { _j = data; } - void config(nlohmann::json&& data) { _j = data; } + void config(const nlohmann::json& data); + void config(nlohmann::json&& data); const nlohmann::json& config() const { return _j; } protected: