aboutsummaryrefslogtreecommitdiff
path: root/src/editor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/editor.rs')
-rw-r--r--src/editor.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/editor.rs b/src/editor.rs
index 9dcbefc..09f7e0d 100644
--- a/src/editor.rs
+++ b/src/editor.rs
@@ -40,6 +40,17 @@ impl Editor {
self.active
};
+ // Handle saving and loading the editor contents to the swap file
+ if rl.is_key_pressed(KeyboardKey::KEY_S) {
+ self.map_data
+ .write_file("swap.ron")
+ .expect("Unable to write buffer file");
+ } else if rl.is_key_pressed(KeyboardKey::KEY_L) {
+ self.map_data
+ .load_file("swap.ron")
+ .expect("Unable to read buffer file");
+ }
+
for tool in &mut self.tools {
tool.update(&self.map_data, rl, transform);
}