diff options
Diffstat (limited to 'src/tool/mod.rs')
| -rw-r--r-- | src/tool/mod.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tool/mod.rs b/src/tool/mod.rs index aeabf19..70534ac 100644 --- a/src/tool/mod.rs +++ b/src/tool/mod.rs @@ -1,3 +1,11 @@ +//! Tools, which are user interfaces that must be specifically selected in order to do something. +//! +//! As stated, a tool is not simply everything that helps a user do something, think of it more as a +//! mode which must be elected by the user to perform a task on a specific object type or a class of +//! objects. If instead the operation is defined by the state of the program, it is not a tool, since +//! the user didn't explicitly ask for this function to be performed, but it is rather an option +//! that's inherent to the situation the user finds themselves in. + pub mod deletion_tool; pub mod icon_tool; pub mod polygon_room_tool; @@ -20,16 +28,31 @@ use raylib::core::drawing::RaylibDrawHandle; #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] #[repr(u8)] +/// The types of tools available in graf karto. For information about the tool itself, please see the +/// referenced Tool's documentation. pub enum ToolType { + /// See [super::RectRoomTool] for information on this tool. RectRoomTool, + /// See [super::PolygonRoomTool] for information on this tool. PolygonRoomTool, + /// See [super::WallTool] for information on this tool. WallTool, + /// See [super::IconTool] for information on this tool. IconTool, + /// See [super::DeletionTool] for information on this tool. DeletionTool, + /// See [super::SelectionTool] for information on this tool. SelectionTool, + /// Not a real tool but used to know how many tools are available. New tools must be added + /// above this variant. + // TODO: Since we now use a hash map in the editor, check if this is still necessary at all. NumTools, } +/// Base trait for tools. A tool is something that performs a specific action on one or more types of +/// elements. It must be selected in order to be active. For this reason, the selection tool is a +/// tool (it must be selected from the toolbox), but the dimension indicator for instance is not, +/// since it is automatically updated when applicable. pub trait Tool { /// Code that needs to be called when this Tool is activated or reactivated goes here. fn activate(&mut self) {} |
