Skip to content

Commit

Permalink
docs(engine): modify toolbox comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Teresa Matos authored and teres4 committed Nov 28, 2023
1 parent 2ab5765 commit 925018a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
1 change: 1 addition & 0 deletions tools/tesseratos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set(TESSERATOS_SOURCE
"src/tesseratos/scene_editor/plugin.cpp"
"src/tesseratos/debug_camera/plugin.cpp"
"src/tesseratos/voxel_palette_editor/plugin.cpp"
"src/tesseratos/toolbox/plugin.cpp"
)

add_library(tesseratos ${TESSERATOS_SOURCE})
Expand Down
35 changes: 18 additions & 17 deletions tools/tesseratos/include/tesseratos/toolbox/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace tesseratos
/// @defgroup tesseratos-toolbox-plugin Toolbox
/// @ingroup tesseratos
/// @brief Adds a resource used to keep track of whether each tool is open or not.
///
/// ## Resources
/// - @ref Toolbox
///
Expand All @@ -25,32 +26,32 @@ namespace tesseratos
class Toolbox final
{
public:
/// @brief When called for the first time for a given name stores a new boolean for it, by default set to false.
/// @param toolName The tools name
///@return Tools associated boolean.
bool isOpen(std::string toolName);
/// @brief Checks if the tool with the given name is open.
/// @param toolName Tool name.
///@return Whether the tool is open.
bool isOpen(const std::string& toolName);

/// @brief Opens a tool
/// @param toolName The tools name
void open(std::string toolName);
/// @brief Opens a tool.
/// @param toolName Tool name.
void open(const std::string& toolName);

/// @brief Closes a tool
/// @param toolName The tools name
void close(std::string toolName);
/// @brief Closes a tool.
/// @param toolName Tool name.
void close(const std::string& toolName);

/// @brief Sets the boolean of a tool to its logical opposite state
/// @param toolName The tools name
void doClick(std::string toolName);
/// @brief If the given tool is open, closes it. Otherwise, opens it.
/// @param toolName Tool name.
void toggle(const std::string& toolName);

/// @brief Returns the beggining of the ToolsMap
/// @return begginng of the map
/// @brief Returns the beggining of the map with known tools.
/// @return Begginng of the map.
auto begin() const
{
return mToolsMap.begin();
}

/// @brief Returns the end of the ToolsMap
/// @return end of the map
/// @brief Returns the end of the map with known tools.
/// @return End of the map.
auto end() const
{
return mToolsMap.end();
Expand Down
10 changes: 5 additions & 5 deletions tools/tesseratos/src/tesseratos/toolbox/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using cubos::engine::Cubos;

using namespace tesseratos;

bool Toolbox::isOpen(std::string toolName)
bool Toolbox::isOpen(const std::string& toolName)
{
if (mToolsMap.contains(toolName))
{
Expand All @@ -22,17 +22,17 @@ bool Toolbox::isOpen(std::string toolName)
return false;
}

void Toolbox::open(std::string toolName)
void Toolbox::open(const std::string& toolName)
{
mToolsMap[toolName] = true;
}

void Toolbox::close(std::string toolName)
void Toolbox::close(const std::string& toolName)
{
mToolsMap[toolName] = false;
}

void Toolbox::doClick(std::string toolName)
void Toolbox::toggle(const std::string& toolName)
{
mToolsMap[toolName] = !mToolsMap[toolName];
}
Expand All @@ -46,7 +46,7 @@ static void showToolbox(Write<Toolbox> toolbox)
bool check = open;
if (ImGui::Checkbox(data(tool), &check))
{
toolbox->doClick(tool);
toolbox->toggle(tool);
}
}

Expand Down

0 comments on commit 925018a

Please sign in to comment.