diff options
Diffstat (limited to 'src/tool')
| -rw-r--r-- | src/tool/deletion_tool.rs | 13 | ||||
| -rw-r--r-- | src/tool/polygon_room_tool.rs | 10 | ||||
| -rw-r--r-- | src/tool/rect_room_tool.rs | 4 | ||||
| -rw-r--r-- | src/tool/selection_tool.rs | 13 |
4 files changed, 13 insertions, 27 deletions
diff --git a/src/tool/deletion_tool.rs b/src/tool/deletion_tool.rs index 5ff3e6a..cd38f6c 100644 --- a/src/tool/deletion_tool.rs +++ b/src/tool/deletion_tool.rs @@ -1,8 +1,8 @@ use super::Tool; +use crate::colours::DEFAULT_COLOURS; use crate::map::Map; use crate::math::{Rect, Surface, Vec2}; use crate::transform::Transform; -use crate::colours::DEFAULT_COLOURS; use raylib::core::drawing::{RaylibDraw, RaylibDrawHandle}; pub struct DeletionTool { @@ -36,15 +36,8 @@ impl Tool for DeletionTool { fn draw(&self, rld: &mut RaylibDrawHandle, transform: &Transform) { if let Some((pos1, pos2)) = self.deletion_rect { let rect_px = transform.rect_m_to_px(&Rect::bounding_rect(pos1, pos2)); - rld.draw_rectangle_rec( - rect_px, - DEFAULT_COLOURS.deletion_rect - ); - rld.draw_rectangle_lines_ex( - rect_px, - 4, - DEFAULT_COLOURS.deletion_rect_outline - ); + rld.draw_rectangle_rec(rect_px, DEFAULT_COLOURS.deletion_rect); + rld.draw_rectangle_lines_ex(rect_px, 4, DEFAULT_COLOURS.deletion_rect_outline); } } diff --git a/src/tool/polygon_room_tool.rs b/src/tool/polygon_room_tool.rs index 1b079d2..de6714d 100644 --- a/src/tool/polygon_room_tool.rs +++ b/src/tool/polygon_room_tool.rs @@ -1,8 +1,8 @@ use super::Tool; +use crate::colours::DEFAULT_COLOURS; use crate::map::Map; use crate::math::{self, Polygon, PolygonError, Vec2}; use crate::transform::Transform; -use crate::colours::DEFAULT_COLOURS; use raylib::core::drawing::{RaylibDraw, RaylibDrawHandle}; struct UnfinishedPolygon { @@ -103,7 +103,7 @@ impl Tool for PolygonRoomTool { transform.point_m_to_px(&polygon.corners[0]), transform.point_m_to_px(&polygon.working_corner), transform.length_m_to_px(0.1) as f32, - DEFAULT_COLOURS.room_selected + DEFAULT_COLOURS.room_selected, ); } else if polygon.corners.len() == 2 { // We have three valid corners, so we can draw a triangle. @@ -111,7 +111,7 @@ impl Tool for PolygonRoomTool { transform.point_m_to_px(&polygon.corners[0]), transform.point_m_to_px(&polygon.corners[1]), transform.point_m_to_px(&polygon.working_corner), - DEFAULT_COLOURS.room_selected + DEFAULT_COLOURS.room_selected, ) } else { // A proper polygon can be drawn. @@ -126,7 +126,7 @@ impl Tool for PolygonRoomTool { transform.point_m_to_px(&triangle[0]), transform.point_m_to_px(&triangle[1]), transform.point_m_to_px(&triangle[2]), - DEFAULT_COLOURS.room_selected + DEFAULT_COLOURS.room_selected, ) } } else if polygon.check_validity_completed().is_ok() { @@ -138,7 +138,7 @@ impl Tool for PolygonRoomTool { transform.point_m_to_px(&triangle[0]), transform.point_m_to_px(&triangle[1]), transform.point_m_to_px(&triangle[2]), - DEFAULT_COLOURS.room_selected + DEFAULT_COLOURS.room_selected, ) } } diff --git a/src/tool/rect_room_tool.rs b/src/tool/rect_room_tool.rs index dfda495..29173cd 100644 --- a/src/tool/rect_room_tool.rs +++ b/src/tool/rect_room_tool.rs @@ -1,8 +1,8 @@ use super::Tool; +use crate::colours::DEFAULT_COLOURS; use crate::map::Map; use crate::math::{Rect, Vec2}; use crate::transform::Transform; -use crate::colours::DEFAULT_COLOURS; use raylib::core::drawing::{RaylibDraw, RaylibDrawHandle}; pub struct RectRoomTool { @@ -35,7 +35,7 @@ impl Tool for RectRoomTool { if let Some((pos1, pos2)) = self.unfinished_rect { rld.draw_rectangle_rec( transform.rect_m_to_px(&Rect::bounding_rect(pos1, pos2)), - DEFAULT_COLOURS.room_selected + DEFAULT_COLOURS.room_selected, ); } } diff --git a/src/tool/selection_tool.rs b/src/tool/selection_tool.rs index 49efba9..30f91bf 100644 --- a/src/tool/selection_tool.rs +++ b/src/tool/selection_tool.rs @@ -1,9 +1,9 @@ use super::Tool; +use crate::colours::DEFAULT_COLOURS; use crate::map::Map; use crate::math::{Rect, Surface, Vec2}; use crate::transform::Transform; use raylib::core::drawing::{RaylibDraw, RaylibDrawHandle}; -use crate::colours::DEFAULT_COLOURS; pub struct SelectionTool { selection_rect: Option<(Vec2<f64>, Vec2<f64>)>, @@ -31,15 +31,8 @@ impl Tool for SelectionTool { fn draw(&self, rld: &mut RaylibDrawHandle, transform: &Transform) { if let Some((pos1, pos2)) = self.selection_rect { let rect_px = transform.rect_m_to_px(&Rect::bounding_rect(pos1, pos2)); - rld.draw_rectangle_rec( - rect_px, - DEFAULT_COLOURS.selection_rect - ); - rld.draw_rectangle_lines_ex( - rect_px, - 4, - DEFAULT_COLOURS.selection_rect_outline - ); + rld.draw_rectangle_rec(rect_px, DEFAULT_COLOURS.selection_rect); + rld.draw_rectangle_lines_ex(rect_px, 4, DEFAULT_COLOURS.selection_rect_outline); } } |
