fixed flash glitch, added hue angle label
This commit is contained in:
		| @@ -8,6 +8,7 @@ | ||||
|  | ||||
| #include "Huey.hpp" | ||||
| #include <libscscreensaver.hpp> | ||||
| #include <string> | ||||
|  | ||||
| class Huey : public ScreensaverPlugin { | ||||
|     public: | ||||
| @@ -45,9 +46,20 @@ void Huey::draw_frame() { | ||||
|     cairo_rectangle(_c, _r.x, _r.y, _r.width, _r.height); | ||||
|     cairo_fill(_c); | ||||
|  | ||||
|     // show hue value | ||||
|     std::string hue_text {std::to_string(static_cast<int>(_hue))}; | ||||
|     cairo_set_source_rgb(_c, 0, 0, 0); | ||||
|     cairo_select_font_face(_c, "Helvetica", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); | ||||
|     cairo_set_font_size(_c, 24); | ||||
|     cairo_move_to(_c, 30, 50); | ||||
|     cairo_show_text(_c, hue_text.c_str()); | ||||
|     cairo_set_source_rgb(_c, 1, 1, 1); | ||||
|     cairo_move_to(_c, 29, 49); | ||||
|     cairo_show_text(_c, hue_text.c_str()); | ||||
|  | ||||
|     // update for next frame | ||||
|     _hue += 0.5; | ||||
|     if (_hue > 360.0) { | ||||
|     if (_hue >= 360.0) { | ||||
|         _hue -= 360.0; | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user