aboutsummaryrefslogtreecommitdiff
path: root/src/tool/rect_room_tool.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tool/rect_room_tool.rs')
-rw-r--r--src/tool/rect_room_tool.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/tool/rect_room_tool.rs b/src/tool/rect_room_tool.rs
index dfda495..7cb85bb 100644
--- a/src/tool/rect_room_tool.rs
+++ b/src/tool/rect_room_tool.rs
@@ -1,10 +1,15 @@
+//! The rectangle room tool is a specialised tool to create rooms of rectangular shape and with the
+//! sides of the room parallel to the x and y-axes. This is often useful, when a quick room creation
+//! is necessary and the shape of the room does not have to be very special.
+
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};
+/// The tool to create simple, rectangular rooms.
pub struct RectRoomTool {
/// The rectangle that is currently being drawn by the user. Once it is finished, it will be
/// pushed into the room_rects.
@@ -12,7 +17,8 @@ pub struct RectRoomTool {
}
impl RectRoomTool {
- /// Create a new room tool where no rooms have been drawn yet.
+ /// Create a new room tool where no rooms have been drawn yet. Should be created only once per
+ /// program instance and by the editor.
pub fn new() -> Self {
Self {
unfinished_rect: None,
@@ -35,7 +41,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,
);
}
}