aboutsummaryrefslogtreecommitdiff
path: root/src/editor.rs
diff options
context:
space:
mode:
authorArne Dußin2020-11-01 18:45:42 +0100
committerArne Dußin2020-11-01 18:45:42 +0100
commit521805eb2fbe17061fb957c2970c6865d86656fc (patch)
treee03490eebdf3727266dd872f873681cc75786b7f /src/editor.rs
parentb87b10a03e98c757aad72ac79a32f2117b318375 (diff)
downloadgraf_karto-521805eb2fbe17061fb957c2970c6865d86656fc.tar.gz
graf_karto-521805eb2fbe17061fb957c2970c6865d86656fc.zip
Add feature to load and save to a test swap-file
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);
}