Bob Polis
8dd1a0f44f
Color moved from libscscreensaver to libscgui, because it's more generic than for just screensavers. This forced me to add a libscgui dependency to all plugins.
33 lines
672 B
C++
33 lines
672 B
C++
#include "Default.hpp"
|
|
#include <libscgui.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);
|
|
}
|