diff options
| author | Arne Dußin | 2020-12-21 01:22:15 +0100 |
|---|---|---|
| committer | Arne Dußin | 2020-12-21 21:15:55 +0100 |
| commit | d7e9c3cc46d616c2fcd1a6e9f73adbb79c6570b4 (patch) | |
| tree | e5633f4d3b18472922c943d759e9f58722ba4405 /src/tool/mod.rs | |
| parent | 48f321a80970ebeb8374072b1d2e0a4d297aa348 (diff) | |
| download | graf_karto-d7e9c3cc46d616c2fcd1a6e9f73adbb79c6570b4.tar.gz graf_karto-d7e9c3cc46d616c2fcd1a6e9f73adbb79c6570b4.zip | |
Add previously missing docs where appropriate
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) {} |
