From 395b10f31be55210ef1dd54b25df82d0d4674ff0 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Tue, 27 Oct 2020 17:20:23 +0100 Subject: [PATCH] fixed interface, reorganized to put all of class declaration and implementation in cpp file --- rects/RectSaver.cpp | 15 +++++++++++++++ rects/RectSaver.hpp | 14 ++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/rects/RectSaver.cpp b/rects/RectSaver.cpp index 37ea057..caaabd8 100644 --- a/rects/RectSaver.cpp +++ b/rects/RectSaver.cpp @@ -7,6 +7,21 @@ // #include "RectSaver.hpp" +#include + +class RectSaver : public ScreensaverPlugin { + public: + RectSaver() = default; + ~RectSaver() = default; + + void setup(cairo_t* context, const cairo_rectangle_t& rect) override; + void draw_frame() override; + int fps() const override; +}; + +ScreensaverPlugin* create_instance() { + return new RectSaver; +} void RectSaver::setup(cairo_t* context, const cairo_rectangle_t& rect) { ScreensaverPlugin::setup(context, rect); diff --git a/rects/RectSaver.hpp b/rects/RectSaver.hpp index a3885a8..6012739 100644 --- a/rects/RectSaver.hpp +++ b/rects/RectSaver.hpp @@ -9,16 +9,10 @@ #ifndef _RectSaver_H_ #define _RectSaver_H_ -#include "ScreensaverPlugin.hpp" +class ScreensaverPlugin; -class RectSaver : public ScreensaverPlugin { - public: - RectSaver() = default; - ~RectSaver() = default; - - void setup(cairo_t* context, const cairo_rectangle_t& rect) override; - void draw_frame() override; - int fps() const override; -}; +extern "C" { + ScreensaverPlugin* create_instance(); +} #endif // _RectSaver_H_