Skip to content

Commit

Permalink
Add checkbox for bool field in editor ui (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
CRAFTSTARCN authored Sep 9, 2022
1 parent 2145422 commit b5a0106
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions engine/source/editor/source/editor_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,24 @@ namespace Piccolo
g_editor_global_context.m_scene_manager->drawSelectedEntityAxis();
}
};
m_editor_ui_creator["bool"] = [this](const std::string& name, void* value_ptr) -> void {
if(g_node_depth == -1)
{
std::string label = "##" + name;
ImGui::Text("%s", name.c_str());
ImGui::SameLine();
ImGui::Checkbox(label.c_str(), static_cast<bool*>(value_ptr));
}
else
{
if(g_editor_node_state_array[g_node_depth].second)
{
std::string full_label = "##" + getLeafUINodeParentLabel() + name;
ImGui::Text("%s", name.c_str());
ImGui::Checkbox(full_label.c_str(), static_cast<bool*>(value_ptr));
}
}
};
m_editor_ui_creator["int"] = [this](const std::string& name, void* value_ptr) -> void {
if (g_node_depth == -1)
{
Expand Down

0 comments on commit b5a0106

Please sign in to comment.