diff --git a/Cargo.toml b/Cargo.toml index c422d89..c8866d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ edition = "2021" [dependencies] eframe = { version = "*", features = ["dark-light"] } egui = { version = "*", features = ["deadlock_detection"]} +egui_file = "*" json = "*" serde = { version = "*", features = ["derive"] } serde_json = "*" diff --git a/src/dialog/file_dialog.rs b/src/dialog/file_dialog.rs new file mode 100644 index 0000000..8520062 --- /dev/null +++ b/src/dialog/file_dialog.rs @@ -0,0 +1,10 @@ +pub struct FileDialog { + dialog: egui_file::FileDialog, +} + +impl super::Dialog for FileDialog { + fn open(&mut self) { + self.dialog = egui_file::FileDialog::open_file(None); + self.dialog.open(); + } +} diff --git a/src/dialog/mod.rs b/src/dialog/mod.rs new file mode 100644 index 0000000..1bb90e5 --- /dev/null +++ b/src/dialog/mod.rs @@ -0,0 +1,9 @@ +pub mod file_dialog; +pub trait View { + fn ui(&mut self, ui: &mut egui::Ui); +} + +pub trait Dialog { + fn open(&mut self); + fn show(&mut self, ctx: &egui::Context); +} diff --git a/src/lib.rs b/src/lib.rs index 8d3728f..003d105 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,2 +1,3 @@ pub mod gui; pub mod sheet; +pub mod dialog; diff --git a/src/main.rs b/src/main.rs index 2dbc59a..b03a55e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,16 +7,14 @@ fn main() { eframe::run_native( "Billy Sheet editor", options, - Box::new(|_ctx| { - // ctx.egui_ctx.options().screen_reader = true; - Box::::default() - }), + Box::new(|_ctx| Box::::default()), ); } #[derive(Debug)] struct Gui { sheet: billy_sheet::sheet::CharacterSheet, + dialogs: Vec, edit_mode: bool, } @@ -24,6 +22,7 @@ impl Default for Gui { fn default() -> Self { Self { sheet: billy_sheet::sheet::CharacterSheet::default(), + dialogs: Vec::new(), edit_mode: true, } }