Skip to main content

Crate egui_screensaver_mystify

Crate egui_screensaver_mystify 

Source
Expand description

Mystify screensaver for egui.

Renders two bouncing quadrilaterals with colour-cycling trails onto the egui background layer, recreating the classic Windows 3.x Mystify screen saver. The simulation runs at a fixed 30 fps time-step regardless of the actual display refresh rate so the animation looks identical on any monitor. Repaints are capped at 30 FPS; if the hardware cannot sustain that rate the screensaver animates as fast as possible without any artificial delay.

§Usage

use egui_screensaver_mystify::MystifyBackground;

struct MyApp {
    mystify: MystifyBackground,
}

impl eframe::App for MyApp {
    fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
        let ctx = ui.ctx().clone();
        // Call paint once per frame before drawing any UI windows so the
        // screensaver sits on the background layer behind everything else.
        self.mystify.paint(&ctx);
    }
}

Structs§

MystifyBackground
Mystify screensaver state.