Files
screensaver/modules/Default/Default.cpp
Bob Polis bb03204f1c Add version() to each plugin
And display it in the screensaver tool with the -l option.
2025-02-14 13:04:27 +01:00

38 lines
782 B
C++

#include "Default.hpp"
#include <libsccolor.hpp>
#include <libscscreensaver.hpp>
class Default : public ScreensaverPlugin {
public:
Default() = default;
~Default() = default;
int fps() const override;
void update() override;
void render() override;
std::string version() const override;
};
ScreensaverPlugin* create_instance() {
return new Default;
}
std::string Default::version() const {
return "1.0.0";
}
int Default::fps() const {
return 2;
}
void Default::update() {
}
void Default::render() {
cairo_set_source_rgba(_c, random01(), random01(), random01(), random01());
cairo_rectangle_t rect {random_rect()};
cairo_rectangle(_c, rect.x, rect.y, rect.width, rect.height);
cairo_fill(_c);
}