Adding a function to easily write teh character sheet.
This commit is contained in:
parent
542923ccef
commit
05473a0a33
@ -1,6 +1,7 @@
|
||||
use eframe::egui::widgets::DragValue;
|
||||
use eframe::egui::Ui;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::io::Write as _;
|
||||
|
||||
use crate::gui::SheetGui;
|
||||
|
||||
@ -36,6 +37,12 @@ pub struct CharacterSheet {
|
||||
money: u32,
|
||||
}
|
||||
|
||||
pub fn write_sheet(path: &std::path::Path, sheet: &CharacterSheet) -> std::io::Result<()> {
|
||||
let sheet_str = serde_json::to_string_pretty(&sheet)?;
|
||||
let mut file = std::fs::File::create(path)?;
|
||||
write!(file, "{}", sheet_str)
|
||||
}
|
||||
|
||||
impl CharacterSheet {
|
||||
pub fn character_class(&self) -> &Classe {
|
||||
&self.character_class
|
||||
|
Loading…
Reference in New Issue
Block a user