diff options
| author | Arne Dußin | 2020-12-21 21:12:01 +0100 |
|---|---|---|
| committer | GitHub | 2020-12-21 21:12:01 +0100 |
| commit | c435f278eddcada279fdc424120e4a1448843c20 (patch) | |
| tree | be9a5601e99608966d4ccd146c3bfb3a70c7fc02 /src/main.rs | |
| parent | 3bc690803fb59493ea8180fd630d65b3e26642d0 (diff) | |
| parent | 82d11b7d3e15d8175accf7579db1fbe528fc6583 (diff) | |
| download | graf_karto-c435f278eddcada279fdc424120e4a1448843c20.tar.gz graf_karto-c435f278eddcada279fdc424120e4a1448843c20.zip | |
Merge pull request #24 from LordSentox/refactor
Refactor to make interaction between tools easier
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs index 7e04456..8ddc587 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,13 +4,15 @@ extern crate log; pub mod button; +pub mod colours; pub mod config; 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 +77,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 +91,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); |
