aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorArne Dußin2020-12-15 00:46:54 +0100
committerArne Dußin2020-12-15 22:51:46 +0100
commit9799d3c6a8f0c242668203a1c70d7b6cfed3e855 (patch)
tree9116acbc886f680f82309a42b4e6147e65c1433b /src/main.rs
parent3bc690803fb59493ea8180fd630d65b3e26642d0 (diff)
downloadgraf_karto-9799d3c6a8f0c242668203a1c70d7b6cfed3e855.tar.gz
graf_karto-9799d3c6a8f0c242668203a1c70d7b6cfed3e855.zip
Refactor to make interaction between tools easier
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs
index 7e04456..de42ab7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -9,8 +9,9 @@ pub mod dimension_indicator;
pub mod editor;
pub mod grid;
pub mod gui;
-pub mod map_data;
+pub mod map;
pub mod math;
+pub mod scaleable;
pub mod svg;
pub mod tool;
pub mod transform;
@@ -75,6 +76,8 @@ fn main() {
if rl.is_mouse_button_down(MouseButton::MOUSE_MIDDLE_BUTTON) {
transform.move_by_px(&(rl.get_mouse_position() - last_mouse_pos).into());
}
+ // Update the last mouse position
+ last_mouse_pos = rl.get_mouse_position();
let mouse_wheel_move = rl.get_mouse_wheel_move();
if mouse_wheel_move != 0 {
@@ -87,19 +90,17 @@ fn main() {
}
editor.update(
- &rl,
+ &mut rl,
&transform,
- ToolSidebar::mouse_captured(screen_height as u16, rl.get_mouse_position().into()),
+ ToolSidebar::mouse_captured(screen_height as u16, last_mouse_pos.into()),
);
- // Update the last mouse position
- last_mouse_pos = rl.get_mouse_position();
-
// Drawing section
{
let mut d = rl.begin_drawing(&thread);
d.clear_background(Color::BLACK);
grid::draw_grid(&mut d, screen_width, screen_height, &transform);
+ editor.map().draw(&mut d, &transform);
editor.draw_tools(&mut d, &transform);
tool_sidebar.draw(screen_height as u16, &mut d, &mut editor);