use crate::math::{Rect, Vec2}; use serde::{Deserialize, Serialize}; use std::io; use std::path::Path; /// All the data of the currently opened map. This does not include things that are currently being /// drawn, but not finished. It also does not contain Metadata, like the current position of the /// transform, or the zoom-level #[derive(Serialize, Deserialize)] pub struct MapData { rooms: Vec>, walls: Vec<(Vec2, Vec2)>, } impl MapData { pub fn new() -> Self { Self { rooms: Vec::new(), walls: Vec::new(), } } pub fn load_file>(&mut self, path: P) -> io::Result { todo!() } pub fn write_file>(&self, path: P) -> io::Result<()> { todo!() } pub fn rooms(&self) -> &Vec> { &self.rooms } pub fn rooms_mut(&mut self) -> &mut Vec> { &mut self.rooms } pub fn walls(&self) -> &Vec<(Vec2, Vec2)> { &self.walls } pub fn walls_mut(&mut self) -> &mut Vec<(Vec2, Vec2)> { &mut self.walls } }