Add version() to each plugin
And display it in the screensaver tool with the -l option.
This commit is contained in:
@ -10,12 +10,17 @@ class Default : public ScreensaverPlugin {
|
|||||||
int fps() const override;
|
int fps() const override;
|
||||||
void update() override;
|
void update() override;
|
||||||
void render() override;
|
void render() override;
|
||||||
|
std::string version() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
ScreensaverPlugin* create_instance() {
|
ScreensaverPlugin* create_instance() {
|
||||||
return new Default;
|
return new Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Default::version() const {
|
||||||
|
return "1.0.0";
|
||||||
|
}
|
||||||
|
|
||||||
int Default::fps() const {
|
int Default::fps() const {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ class FadingRects : public ScreensaverPlugin {
|
|||||||
int fps() const override;
|
int fps() const override;
|
||||||
void update () override;
|
void update () override;
|
||||||
void render() override;
|
void render() override;
|
||||||
|
std::string version() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double _hue {0.0};
|
double _hue {0.0};
|
||||||
@ -53,6 +54,10 @@ ScreensaverPlugin* create_instance() {
|
|||||||
return new FadingRects;
|
return new FadingRects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string FadingRects::version() const {
|
||||||
|
return "1.1.0";
|
||||||
|
}
|
||||||
|
|
||||||
int FadingRects::fps() const {
|
int FadingRects::fps() const {
|
||||||
return 20;
|
return 20;
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ class Grid : public ScreensaverPlugin {
|
|||||||
int fps() const override;
|
int fps() const override;
|
||||||
void update() override;
|
void update() override;
|
||||||
void render() override;
|
void render() override;
|
||||||
|
std::string version() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
size_t _h;
|
size_t _h;
|
||||||
@ -109,6 +110,10 @@ void Grid::configure() {
|
|||||||
setup(_c, _r);
|
setup(_c, _r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Grid::version() const {
|
||||||
|
return "1.0.0";
|
||||||
|
}
|
||||||
|
|
||||||
int Grid::fps() const {
|
int Grid::fps() const {
|
||||||
return 30;
|
return 30;
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ class Huey : public ScreensaverPlugin {
|
|||||||
int fps() const override;
|
int fps() const override;
|
||||||
void update() override;
|
void update() override;
|
||||||
void render() override;
|
void render() override;
|
||||||
|
std::string version() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double _hue {0};
|
double _hue {0};
|
||||||
@ -21,6 +22,10 @@ ScreensaverPlugin* create_instance() {
|
|||||||
return new Huey;
|
return new Huey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Huey::version() const {
|
||||||
|
return "1.1.0";
|
||||||
|
}
|
||||||
|
|
||||||
int Huey::fps() const {
|
int Huey::fps() const {
|
||||||
return 50;
|
return 50;
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ class Whirling : public ScreensaverPlugin {
|
|||||||
void update() override;
|
void update() override;
|
||||||
void render() override;
|
void render() override;
|
||||||
void configure() override;
|
void configure() override;
|
||||||
|
std::string version() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Lissajous> knots;
|
std::vector<Lissajous> knots;
|
||||||
@ -46,6 +47,10 @@ ScreensaverPlugin* create_instance() {
|
|||||||
return new Whirling;
|
return new Whirling;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Whirling::version() const {
|
||||||
|
return "1.0.0";
|
||||||
|
}
|
||||||
|
|
||||||
int Whirling::fps() const {
|
int Whirling::fps() const {
|
||||||
return 30;
|
return 30;
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,9 @@ void print_help() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void list_plugins() {
|
void list_plugins() {
|
||||||
for (const std::string& name : sc::plugin<ScreensaverPlugin>::names()) {
|
for (const auto& elem : sc::plugin<ScreensaverPlugin>::all()) {
|
||||||
std::cout << name << '\n';
|
|
||||||
|
std::cout << elem.first << " (" << elem.second()->version() << ")\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user