// // ScreensaverPlugin.hpp // screensaver // // Created by Bob Polis at 2020-10-26 // Copyright (c) 2020 SwiftCoder. All rights reserved. // #ifndef _ScreensaverPlugin_H_ #define _ScreensaverPlugin_H_ #include #include class ScreensaverPlugin { public: ScreensaverPlugin() = default; virtual ~ScreensaverPlugin() = default; virtual void setup(cairo_t* context, const cairo_rectangle_t& rect) = 0; virtual void draw_frame() = 0; virtual int fps() const = 0; protected: cairo_t* _c {nullptr}; cairo_rectangle_t _r {}; std::random_device _dev {}; std::default_random_engine _eng {_dev()}; void make_black(); cairo_rectangle_t random_rect(); double random_x(); double random_y(); double random01(); }; #endif // _ScreensaverPlugin_H_