33 lines
674 B
C++
33 lines
674 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;
|
|
};
|
|
|
|
ScreensaverPlugin* create_instance() {
|
|
return new Default;
|
|
}
|
|
|
|
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);
|
|
}
|