End of day commit.
This commit is contained in:
		
					parent
					
						
							
								877d300a5c
							
						
					
				
			
			
				commit
				
					
						09c02c8783
					
				
			
		
					 5 changed files with 24 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -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 = "*"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										10
									
								
								src/dialog/file_dialog.rs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/dialog/file_dialog.rs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -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();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										9
									
								
								src/dialog/mod.rs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								src/dialog/mod.rs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -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);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,2 +1,3 @@
 | 
			
		|||
pub mod gui;
 | 
			
		||||
pub mod sheet;
 | 
			
		||||
pub mod dialog;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,16 +7,14 @@ fn main() {
 | 
			
		|||
    eframe::run_native(
 | 
			
		||||
        "Billy Sheet editor",
 | 
			
		||||
        options,
 | 
			
		||||
        Box::new(|_ctx| {
 | 
			
		||||
            // ctx.egui_ctx.options().screen_reader = true;
 | 
			
		||||
            Box::<Gui>::default()
 | 
			
		||||
        }),
 | 
			
		||||
        Box::new(|_ctx| Box::<Gui>::default()),
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Debug)]
 | 
			
		||||
struct Gui {
 | 
			
		||||
    sheet: billy_sheet::sheet::CharacterSheet,
 | 
			
		||||
    dialogs: Vec<impl billy_sheet::dialog::Dialog>,
 | 
			
		||||
    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,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue