Added json config support
This commit is contained in:
parent
42313b010a
commit
d4d77efdff
@ -10,6 +10,7 @@
|
||||
#define _ScreensaverPlugin_H_
|
||||
|
||||
#include <cairo/cairo.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user