🚧 wip: playing with egui

main
_ 2023-09-10 11:22:40 -05:00
parent 99f1f92c1b
commit 6436ac5ceb
3 changed files with 2693 additions and 2 deletions

2665
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
eframe = "0.22.0"
linuxvideo = { path = "deps/LinuxVideo" } linuxvideo = { path = "deps/LinuxVideo" }
rayon = "1.7.0" rayon = "1.7.0"
thiserror = "1.0.48" thiserror = "1.0.48"

View File

@ -9,6 +9,7 @@ use std::{
}, },
}; };
use eframe::egui;
use rayon::ThreadPool; use rayon::ThreadPool;
use crate::controller::*; use crate::controller::*;
@ -119,12 +120,40 @@ fn main() -> Result <(), Error>
let mpf_rgb = (stop - start).as_millis () as f32 / 30.0f32; let mpf_rgb = (stop - start).as_millis () as f32 / 30.0f32;
dbg! (mpf_rgb); dbg! (mpf_rgb);
}, },
Some ("egui") => main_egui (),
Some (_) => eprintln! ("Unknown subcommand"), Some (_) => eprintln! ("Unknown subcommand"),
} }
Ok (()) 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> struct ThreadSystem <'a>
{ {
pool: &'a ThreadPool, pool: &'a ThreadPool,