aboutsummaryrefslogtreecommitdiff
path: root/src/tool/deletion_tool.rs
diff options
context:
space:
mode:
authorArne Dußin2020-11-01 17:44:51 +0100
committerArne Dußin2020-11-01 17:44:51 +0100
commit2db23f3213ff1bb2fe0cf005e922536da7ff5cd7 (patch)
tree912b6d829ea8c8c28a2ed257e70e0fd6814bef50 /src/tool/deletion_tool.rs
parenta6be14ada463cb5a3fc0a810b8b341093abbb68d (diff)
downloadgraf_karto-2db23f3213ff1bb2fe0cf005e922536da7ff5cd7.tar.gz
graf_karto-2db23f3213ff1bb2fe0cf005e922536da7ff5cd7.zip
Refactor a major part of the project
In order to be able to save and load the map, a major rework of the code seemed necessary, since Vector2 and Rectangle of raylib do not implement serialize, and it seems cleanest to use the serialize/deserialize traits of serde, to save for instance to RON. ToolShed was renamed to Editor, since it should better show, that it does quite a bit more than harbour tools. The map data is now centrally saved in the editor, instead of decentralised in the tool structs.
Diffstat (limited to 'src/tool/deletion_tool.rs')
-rw-r--r--src/tool/deletion_tool.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tool/deletion_tool.rs b/src/tool/deletion_tool.rs
index 4d255d9..3eca92a 100644
--- a/src/tool/deletion_tool.rs
+++ b/src/tool/deletion_tool.rs
@@ -1,4 +1,5 @@
use super::Tool;
+use crate::map_data::MapData;
use crate::transform::Transform;
use raylib::core::drawing::RaylibDrawHandle;
use raylib::RaylibHandle;
@@ -12,8 +13,8 @@ impl DeletionTool {
}
impl Tool for DeletionTool {
- fn update(&mut self, rl: &RaylibHandle, transform: &Transform) {}
- fn active_update(&mut self, rl: &RaylibHandle, transform: &Transform) {}
+ fn update(&mut self, map_data: &MapData, rl: &RaylibHandle, transform: &Transform) {}
+ fn active_update(&mut self, map_data: &mut MapData, rl: &RaylibHandle, transform: &Transform) {}
- fn draw(&self, _rld: &mut RaylibDrawHandle, _transform: &Transform) {}
+ fn draw(&self, map_data: &MapData, _rld: &mut RaylibDrawHandle, _transform: &Transform) {}
}