Function run

Source
pub fn run<F>(
    options: NativeOptions,
    app_name: &str,
    main_function: F,
) -> Result
where F: MainFunction,
Expand description

The function which starts a window and calls the main_function each frame. options are passed to eframe::run_native.

ยงExample

use rust_training_tool::gui::run;
use rust_training_tool::{eframe, egui};

let options = eframe::NativeOptions {
    viewport: egui::ViewportBuilder::default()
        .with_inner_size([480.0, 360.0]),
    ..Default::default()
};
run(options, "test", |ctx, _ui| {
    ctx.painter.circle_filled(
        ctx.drawable_area.center(),
        ctx.drawable_area.width() * 0.1,
        egui::Color32::ORANGE,
    );
})
.expect("Gui should run");