start gui with exemple

This commit is contained in:
2025-04-12 16:22:50 +02:00
parent 7d0f215f26
commit 8861538012
4 changed files with 4151 additions and 2 deletions

View File

@@ -1,13 +1,18 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
use eframe::egui;
use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::io::{Seek, SeekFrom};
mod byte_writer;
mod gui;
mod node;
mod read_and_write;
use byte_writer::{binary_to_string, string_to_binary};
use gui::MyApp;
use node::{Node, create_tree, nodes_at_vec, read_tree, tree_to_map, tree_to_string};
use read_and_write::{body_to_bin, get_map_file, is_valid_file, read_n_bytes};
@@ -104,8 +109,20 @@ fn main() -> std::io::Result<()> {
}
}
None => {
println!("No argument to deal with !");
display_options();
let options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default().with_inner_size([320.0, 240.0]),
..Default::default()
};
let _ = eframe::run_native(
"My egui App",
options,
Box::new(|cc| {
// This gives us image support:
egui_extras::install_image_loaders(&cc.egui_ctx);
Ok(Box::<MyApp>::default())
}),
);
}
}