Скатал с официального примера из доков и доволен
parent
a352894552
commit
820fb11ad7
File diff suppressed because it is too large
Load Diff
|
|
@ -4,3 +4,5 @@ version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
eframe = "0.34.2"
|
||||||
|
egui = "0.34.2"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
pub struct App{
|
||||||
|
label: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for App{
|
||||||
|
fn default() -> Self{
|
||||||
|
Self {
|
||||||
|
label: "This is BCS: Brewery Control System".to_owned()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl App{
|
||||||
|
pub fn new(_cc: &eframe::CreationContext<'_>) -> Self{
|
||||||
|
Default::default()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl eframe::App for App{
|
||||||
|
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame){
|
||||||
|
|
||||||
|
egui::Panel::top("top_panel").show_inside(ui, |ui| {
|
||||||
|
egui::MenuBar::new().ui(ui, |ui| {
|
||||||
|
egui::widgets::global_theme_preference_buttons(ui);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
egui::CentralPanel::default().show_inside(ui, |ui|{
|
||||||
|
ui.heading("BCS");
|
||||||
|
ui.horizontal(|ui|{
|
||||||
|
ui.label("write something: ");
|
||||||
|
ui.text_edit_singleline(&mut self.label);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
mod app;
|
||||||
|
pub use app::App;
|
||||||
|
|
@ -1,3 +1,11 @@
|
||||||
fn main() {
|
fn main() -> eframe::Result{
|
||||||
println!("Hello, world!");
|
|
||||||
}
|
let native_opts = eframe::NativeOptions {
|
||||||
|
viewport: egui::ViewportBuilder::default()
|
||||||
|
.with_inner_size([400.0,300.0])
|
||||||
|
.with_min_inner_size([300.0,200.0]),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
eframe::run_native("BCS", native_opts, Box::new(|cc| Ok(Box::new(code::App::new(cc)))),)
|
||||||
|
|
||||||
|
} //Код не работает, ошибка пока и должна быть.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue