From d4d77efdff9e73f72c5bacfbf8fb41f963641eb8 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Wed, 6 Oct 2021 13:43:11 +0200 Subject: [PATCH] Added json config support --- src/ScreensaverPlugin.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ScreensaverPlugin.hpp b/src/ScreensaverPlugin.hpp index 65ac60f..a414309 100644 --- a/src/ScreensaverPlugin.hpp +++ b/src/ScreensaverPlugin.hpp @@ -10,6 +10,7 @@ #define _ScreensaverPlugin_H_ #include +#include class ScreensaverPlugin { public: @@ -22,9 +23,13 @@ class ScreensaverPlugin { virtual void update() = 0; // advance state for next frame virtual void render() = 0; // draw next frame + void config(const nlohmann::json& data) { _j = data; } + const nlohmann::json& config() const { return _j; } + protected: cairo_t* _c {nullptr}; cairo_rectangle_t _r {}; + nlohmann::json _j {}; void make_black(); cairo_rectangle_t random_rect();