🚧 wip: playing with egui
parent
99f1f92c1b
commit
6436ac5ceb
File diff suppressed because it is too large
Load Diff
|
@ -6,6 +6,7 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
eframe = "0.22.0"
|
||||
linuxvideo = { path = "deps/LinuxVideo" }
|
||||
rayon = "1.7.0"
|
||||
thiserror = "1.0.48"
|
||||
|
|
29
src/main.rs
29
src/main.rs
|
@ -9,6 +9,7 @@ use std::{
|
|||
},
|
||||
};
|
||||
|
||||
use eframe::egui;
|
||||
use rayon::ThreadPool;
|
||||
|
||||
use crate::controller::*;
|
||||
|
@ -119,12 +120,40 @@ fn main() -> Result <(), Error>
|
|||
let mpf_rgb = (stop - start).as_millis () as f32 / 30.0f32;
|
||||
dbg! (mpf_rgb);
|
||||
},
|
||||
Some ("egui") => main_egui (),
|
||||
Some (_) => eprintln! ("Unknown subcommand"),
|
||||
}
|
||||
|
||||
Ok (())
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct MyEguiApp {}
|
||||
|
||||
impl MyEguiApp {
|
||||
fn new(cc: &eframe::CreationContext<'_>) -> Self {
|
||||
// Customize egui here with cc.egui_ctx.set_fonts and cc.egui_ctx.set_visuals.
|
||||
// Restore app state using cc.storage (requires the "persistence" feature).
|
||||
// Use the cc.gl (a glow::Context) to create graphics shaders and buffers that you can use
|
||||
// for e.g. egui::PaintCallback.
|
||||
Self::default()
|
||||
}
|
||||
}
|
||||
|
||||
impl eframe::App for MyEguiApp {
|
||||
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
ui.heading("Hello World!");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
fn main_egui ()
|
||||
{
|
||||
let native_options = eframe::NativeOptions::default();
|
||||
eframe::run_native("My egui App", native_options, Box::new(|cc| Box::new(MyEguiApp::new(cc))));
|
||||
}
|
||||
|
||||
struct ThreadSystem <'a>
|
||||
{
|
||||
pool: &'a ThreadPool,
|
||||
|
|
Loading…
Reference in New Issue