added concrete screensaver
This commit is contained in:
parent
751d079225
commit
c52d223f39
24
RectSaver.cpp
Normal file
24
RectSaver.cpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// RectSaver.cpp
|
||||||
|
// screensaver
|
||||||
|
//
|
||||||
|
// Created by Bob Polis at 2020-10-26
|
||||||
|
// Copyright (c) 2020 SwiftCoder. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "RectSaver.hpp"
|
||||||
|
|
||||||
|
RectSaver::RectSaver(cairo_t* context, const cairo_rectangle_t& rect) : ScreensaverPlugin {context, rect} {
|
||||||
|
make_black();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RectSaver::draw_frame() {
|
||||||
|
cairo_set_source_rgb(_c, random01(), random01(), random01());
|
||||||
|
cairo_rectangle_t rect {random_rect()};
|
||||||
|
cairo_rectangle(_c, rect.x, rect.y, rect.width, rect.height);
|
||||||
|
cairo_fill(_c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int RectSaver::fps() const {
|
||||||
|
return 5;
|
||||||
|
}
|
23
RectSaver.hpp
Normal file
23
RectSaver.hpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
//
|
||||||
|
// RectSaver.hpp
|
||||||
|
// screensaver
|
||||||
|
//
|
||||||
|
// Created by Bob Polis at 2020-10-26
|
||||||
|
// Copyright (c) 2020 SwiftCoder. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef _RectSaver_H_
|
||||||
|
#define _RectSaver_H_
|
||||||
|
|
||||||
|
#include "ScreensaverPlugin.hpp"
|
||||||
|
|
||||||
|
class RectSaver : public ScreensaverPlugin {
|
||||||
|
public:
|
||||||
|
RectSaver(cairo_t* context, const cairo_rectangle_t& rect);
|
||||||
|
~RectSaver() = default;
|
||||||
|
|
||||||
|
void draw_frame() override;
|
||||||
|
int fps() const override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _RectSaver_H_
|
Loading…
x
Reference in New Issue
Block a user