diff --git a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp index 080cbf2c..d1e4a74e 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp +++ b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorComponentView.hpp @@ -45,7 +45,7 @@ namespace SHADE if (!component) return; auto componentType = rttr::type::get(*component); - CheckBox("##IsActive", [component]() {return component->isActive; }, [component](bool const& active) {component->isActive = active; }); + SHEditorWidgets::CheckBox("##IsActive", [component]() {return component->isActive; }, [component](bool const& active) {component->isActive = active; }); ImGui::SameLine(); if (ImGui::CollapsingHeader(componentType.get_name().data())) { @@ -57,11 +57,11 @@ namespace SHADE if (type == rttr::type::get()) { - DragVec4(property.get_name().data(), { "X", "Y", "Z", "W" }, [component, property]() {return property.get_value(component).template convert(); }, [component, property](SHVec4 vec) {return property.set_value(component, vec); }); + SHEditorWidgets::DragVec4(property.get_name().data(), { "X", "Y", "Z", "W" }, [component, property]() {return property.get_value(component).template convert(); }, [component, property](SHVec4 vec) {return property.set_value(component, vec); }); } else if (type == rttr::type::get()) { - DragVec3(property.get_name().data(), { "X", "Y", "Z" }, [component, property]() {return property.get_value(component).template convert(); }, [component, property](SHVec3 vec) {return property.set_value(component, vec); }); + SHEditorWidgets::DragVec3(property.get_name().data(), { "X", "Y", "Z" }, [component, property]() {return property.get_value(component).template convert(); }, [component, property](SHVec3 vec) {return property.set_value(component, vec); }); } } } diff --git a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp index ed4792de..9d7ffadd 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/Inspector/SHEditorInspector.cpp @@ -47,7 +47,7 @@ namespace SHADE SHEntity* entity = SHEntityManager::GetEntityByID(eid); ImGui::TextColored(ImGuiColors::green, "EID: %zu", eid); - CheckBox("##IsActive", [entity]()->bool {return entity->GetActive(); }, [entity](bool const& active) {entity->SetActive(active); }); + SHEditorWidgets::CheckBox("##IsActive", [entity]()->bool {return entity->GetActive(); }, [entity](bool const& active) {entity->SetActive(active); }); ImGui::SameLine(); ImGui::InputText("##EntityName", &entity->name); diff --git a/SHADE_Engine/src/Editor/SHEditorUI.cpp b/SHADE_Engine/src/Editor/SHEditorUI.cpp index 16e06f09..65b65827 100644 --- a/SHADE_Engine/src/Editor/SHEditorUI.cpp +++ b/SHADE_Engine/src/Editor/SHEditorUI.cpp @@ -15,6 +15,7 @@ of DigiPen Institute of Technology is prohibited. #include "SHEditorUI.h" // External Dependencies #include +#include "SHEditorWidgets.hpp" namespace SHADE { @@ -136,18 +137,24 @@ namespace SHADE bool SHEditorUI::InputCheckbox(const std::string& label, bool& value) { - return ImGui::Checkbox(label.c_str(), &value); + ImGui::Text(label.c_str()); + ImGui::SameLine(); + return ImGui::Checkbox("#", &value); } bool SHEditorUI::InputInt(const std::string& label, int& value) { - return ImGui::InputInt(label.c_str(), &value, + ImGui::Text(label.c_str()); + ImGui::SameLine(); + return ImGui::InputInt("#", &value, 1, 10, ImGuiInputTextFlags_EnterReturnsTrue); } bool SHEditorUI::InputUnsignedInt(const std::string& label, unsigned int& value) { int signedVal = static_cast(value); - const bool CHANGED = InputInt(label, signedVal); + ImGui::Text(label.c_str()); + ImGui::SameLine(); + const bool CHANGED = InputInt("#", signedVal); if (CHANGED) { signedVal = std::clamp(signedVal, 0, std::numeric_limits::max()); @@ -157,19 +164,25 @@ namespace SHADE } bool SHEditorUI::InputFloat(const std::string& label, float& value) { - return ImGui::InputFloat(label.c_str(), &value, + ImGui::Text(label.c_str()); + ImGui::SameLine(); + return ImGui::InputFloat("#", &value, 0.1f, 1.0f, "%.3f", ImGuiInputTextFlags_EnterReturnsTrue); } bool SHEditorUI::InputDouble(const std::string& label, double& value) { - return ImGui::InputDouble(label.c_str(), &value, + ImGui::Text(label.c_str()); + ImGui::SameLine(); + return ImGui::InputDouble("#", &value, 0.1, 1.0, "%.3f", ImGuiInputTextFlags_EnterReturnsTrue); } bool SHEditorUI::InputAngle(const std::string& label, double& value) { - return ImGui::InputDouble(label.c_str(), &value, + ImGui::Text(label.c_str()); + ImGui::SameLine(); + return ImGui::InputDouble("#", &value, 1.0, 45.0, "%.3f", ImGuiInputTextFlags_EnterReturnsTrue); } @@ -177,7 +190,9 @@ namespace SHADE bool SHEditorUI::InputSlider(const std::string& label, double min, double max, double& value) { float val = static_cast(value); - const bool CHANGED = ImGui::SliderFloat(label.c_str(), &val, + ImGui::Text(label.c_str()); + ImGui::SameLine(); + const bool CHANGED = ImGui::SliderFloat("#", &val, static_cast(min), static_cast(max), "%.3f", ImGuiInputTextFlags_EnterReturnsTrue); @@ -186,70 +201,27 @@ namespace SHADE value = val; } - return CHANGED; } bool SHEditorUI::InputVec2(const std::string& label, SHVec2& value) { - float vec[2] = - { - static_cast(value.x), - static_cast(value.y) - }; - const bool CHANGED = ImGui::InputFloat2(label.c_str(), vec, "%.3f", - ImGuiInputTextFlags_EnterReturnsTrue); - if (CHANGED) - { - value.x = vec[0]; - value.y = vec[1]; - } - return CHANGED; + static const std::vector COMPONENT_LABELS = { "X", "Y" }; + return SHEditorWidgets::DragN(label, COMPONENT_LABELS, { &value.x, &value.y }); } - bool SHEditorUI::InputVec3(const std::string& label, SHVec3& value) + bool SHEditorUI::InputVec3(const std::string& label, SHVec3& value, float speed) { - float vec[3] = - { - static_cast(value.x), - static_cast(value.y), - static_cast(value.z) - }; - const bool CHANGED = ImGui::InputFloat3(label.c_str(), vec, "%.3f", - ImGuiInputTextFlags_EnterReturnsTrue); - if (CHANGED) - { - value.x = vec[0]; - value.y = vec[1]; - value.z = vec[2]; - } - return CHANGED; - } - - bool SHEditorUI::InputSliderVec3(const std::string& label, double min, double max, SHVec3& value) - { - float vec[3] = - { - static_cast(value.x), - static_cast(value.y), - static_cast(value.z) - }; - const bool CHANGED = ImGui::SliderFloat3(label.c_str(), vec, - static_cast(min), static_cast(max), "%.3f", - ImGuiInputTextFlags_EnterReturnsTrue); - if (CHANGED) - { - value.x = vec[0]; - value.y = vec[1]; - value.z = vec[2]; - } - return CHANGED; + static const std::vector COMPONENT_LABELS = { "X", "Y", "Z"}; + return SHEditorWidgets::DragN(label, COMPONENT_LABELS, { &value.x, &value.y, &value.z }, speed, "%.3f"); } bool SHEditorUI::InputTextField(const std::string& label, std::string& value) { std::array buffer = { '\0' }; strcpy_s(buffer.data(), TEXT_FIELD_MAX_LENGTH, value.c_str()); - const bool CHANGED = ImGui::InputText(label.c_str(), &buffer[0], TEXT_FIELD_MAX_LENGTH); + ImGui::Text(label.c_str()); + ImGui::SameLine(); + const bool CHANGED = ImGui::InputText("#", &buffer[0], TEXT_FIELD_MAX_LENGTH); if (CHANGED) { value = std::string(buffer.data(), buffer.data() + TEXT_FIELD_MAX_LENGTH); @@ -259,11 +231,13 @@ namespace SHADE bool SHEditorUI::InputEnumCombo(const std::string& label, int& v, const std::vector& enumNames) { - // Clamp input value const std::string& INITIAL_NAME = v >= static_cast(enumNames.size()) ? "Unknown" : enumNames[v]; bool b = false; - if (ImGui::BeginCombo(label.c_str(), INITIAL_NAME.c_str(), ImGuiComboFlags_None)) + + ImGui::Text(label.c_str()); + ImGui::SameLine(); + if (ImGui::BeginCombo("#", INITIAL_NAME.c_str(), ImGuiComboFlags_None)) { for (int i = 0; i < enumNames.size(); ++i) { diff --git a/SHADE_Engine/src/Editor/SHEditorUI.h b/SHADE_Engine/src/Editor/SHEditorUI.h index 06768b87..13468215 100644 --- a/SHADE_Engine/src/Editor/SHEditorUI.h +++ b/SHADE_Engine/src/Editor/SHEditorUI.h @@ -244,18 +244,7 @@ namespace SHADE /// Label used to identify this widget. /// Reference to the variable to store the result. /// True if the value was changed. - static bool InputVec3(const std::string& label, SHVec3& value); - /// - /// Creates a 3x double slider field widget for Vector3 input. - ///
- /// Wraps up ImGui::InputSliderFloat3(). - ///
- /// Label used to identify this widget. - /// Minimum value of the slider. - /// Maximum value of the slider. - /// Reference to the variable to store the result. - /// True if the value was changed. - static bool InputSliderVec3(const std::string& label, double min, double max, SHVec3& value); + static bool InputVec3(const std::string& label, SHVec3& value, float speed = 0.1f); /// /// Creates a text field widget for string input. ///
diff --git a/SHADE_Engine/src/Editor/SHEditorWidgets.hpp b/SHADE_Engine/src/Editor/SHEditorWidgets.hpp index 4a934e8c..9bdd545c 100644 --- a/SHADE_Engine/src/Editor/SHEditorWidgets.hpp +++ b/SHADE_Engine/src/Editor/SHEditorWidgets.hpp @@ -12,6 +12,7 @@ #include "Math/SHMath.h" #include "Command/SHCommandManager.h" #include "SHImGuiHelpers.hpp" +#include "SH_API.h" //#==============================================================# //|| Library Includes || @@ -26,162 +27,166 @@ namespace SHADE //#==============================================================# //|| Custom Widgets || //#==============================================================# - static bool Splitter(bool verticalSplit, float thickness, float* size1, float* size2, float minSize1, float minSize2, float splitterAxisSize = -1.0f) + class SH_API SHEditorWidgets { - ImGuiWindow* window = ImGui::GetCurrentWindow(); - const ImGuiID id = window->GetID("##Splitter"); - ImRect bb; - bb.Min = window->DC.CursorPos + (verticalSplit ? ImVec2(*size1, 0.0f) : ImVec2(0.0f, *size1)); - bb.Max = bb.Min + (verticalSplit ? ImVec2(thickness, splitterAxisSize) : ImVec2(splitterAxisSize, thickness)); - return ImGui::SplitterBehavior(bb, id, verticalSplit ? ImGuiAxis_X : ImGuiAxis_Y, size1, size2, minSize1, minSize2, 0.0f); - } + public: + // Disable constructor for static class + SHEditorWidgets() = delete; - template - static bool DragN(const std::string& fieldLabel, std::vectorconst& componentLabels, - std::vector values, float speed = 0.1f, const char* displayFormat = "", T valueMin = T(), T valueMax = T(), - ImGuiSliderFlags flags = 0) - { - const ImGuiWindow* const window = ImGui::GetCurrentWindow(); - if (window->SkipItems) - return false; - - const ImGuiContext& g = *GImGui; - bool valueChanged = false; - ImGui::BeginGroup(); - ImGui::PushID(fieldLabel.c_str()); - PushMultiItemsWidthsAndLabels(componentLabels, 0.0f); - ImGui::BeginColumns("DragVecCol", 2, ImGuiOldColumnFlags_NoBorder | ImGuiOldColumnFlags_NoResize); - ImGui::SetColumnWidth(-1, 80.0f); - ImGui::Text(fieldLabel.c_str()); - ImGui::NextColumn(); - for (std::size_t i = 0; i < N; ++i) + static bool Splitter(bool verticalSplit, float thickness, float* size1, float* size2, float minSize1, float minSize2, float splitterAxisSize = -1.0f) { - ImGui::PushID(static_cast(i)); - ImGui::TextUnformatted(componentLabels[i].c_str(), ImGui::FindRenderedTextEnd(componentLabels[i].c_str())); ImGui::SameLine(); - ImGui::SetNextItemWidth(80.0f); - valueChanged |= ImGui::DragFloat("##v", values[i], speed, valueMin, valueMax, displayFormat, flags); - - const ImVec2 min = ImGui::GetItemRectMin(); - const ImVec2 max = ImGui::GetItemRectMax(); - const float spacing = g.Style.FrameRounding; - const float halfSpacing = spacing / 2; - - window->DrawList->AddLine({ min.x + spacing, max.y - halfSpacing }, { max.x - spacing, max.y - halfSpacing }, - ImGuiColors::colors[i], 4); - - ImGui::SameLine(0, g.Style.ItemInnerSpacing.x); + ImGuiWindow* window = ImGui::GetCurrentWindow(); + const ImGuiID id = window->GetID("##Splitter"); + ImRect bb; + bb.Min = window->DC.CursorPos + (verticalSplit ? ImVec2(*size1, 0.0f) : ImVec2(0.0f, *size1)); + bb.Max = bb.Min + (verticalSplit ? ImVec2(thickness, splitterAxisSize) : ImVec2(splitterAxisSize, thickness)); + return ImGui::SplitterBehavior(bb, id, verticalSplit ? ImGuiAxis_X : ImGuiAxis_Y, size1, size2, minSize1, minSize2, 0.0f); + } + + template + static bool DragN(const std::string& fieldLabel, std::vectorconst& componentLabels, + std::vector values, float speed = 0.1f, const char* displayFormat = "", T valueMin = T(), T valueMax = T(), + ImGuiSliderFlags flags = 0) + { + const ImGuiWindow* const window = ImGui::GetCurrentWindow(); + if (window->SkipItems) + return false; + + const ImGuiContext& g = *GImGui; + bool valueChanged = false; + ImGui::BeginGroup(); + ImGui::PushID(fieldLabel.c_str()); + PushMultiItemsWidthsAndLabels(componentLabels, 0.0f); + ImGui::BeginColumns("DragVecCol", 2, ImGuiOldColumnFlags_NoBorder | ImGuiOldColumnFlags_NoResize); + ImGui::SetColumnWidth(-1, 80.0f); + ImGui::Text(fieldLabel.c_str()); + ImGui::NextColumn(); + for (std::size_t i = 0; i < N; ++i) + { + ImGui::PushID(static_cast(i)); + ImGui::TextUnformatted(componentLabels[i].c_str(), ImGui::FindRenderedTextEnd(componentLabels[i].c_str())); ImGui::SameLine(); + ImGui::SetNextItemWidth(80.0f); + valueChanged |= ImGui::DragFloat("##v", values[i], speed, valueMin, valueMax, displayFormat, flags); + + const ImVec2 min = ImGui::GetItemRectMin(); + const ImVec2 max = ImGui::GetItemRectMax(); + const float spacing = g.Style.FrameRounding; + const float halfSpacing = spacing / 2; + + window->DrawList->AddLine({ min.x + spacing, max.y - halfSpacing }, { max.x - spacing, max.y - halfSpacing }, + ImGuiColors::colors[i], 4); + + ImGui::SameLine(0, g.Style.ItemInnerSpacing.x); + ImGui::PopID(); + ImGui::PopItemWidth(); + } + ImGui::EndColumns(); ImGui::PopID(); - ImGui::PopItemWidth(); + ImGui::EndGroup(); + + return valueChanged; } - ImGui::EndColumns(); - ImGui::PopID(); - ImGui::EndGroup(); - - return valueChanged; - } - - static bool DragVec2(const std::string& fieldLabel, std::vectorconst& componentLabels, std::function get, - std::function set, float speed = 0.1f, const char* displayFormat = "%.3f", float valueMin = 0.0f, float valueMax = 0.0f, - ImGuiSliderFlags flags = 0) - { - SHVec2 values = get(); - bool changed = false; - if (DragN(fieldLabel, componentLabels, {&values.x, &values.y}, speed, displayFormat, valueMin, valueMax, flags)) + + static bool DragVec2(const std::string& fieldLabel, std::vectorconst& componentLabels, std::function get, + std::function set, float speed = 0.1f, const char* displayFormat = "%.3f", float valueMin = 0.0f, float valueMax = 0.0f, + ImGuiSliderFlags flags = 0) { - changed = true; + SHVec2 values = get(); + bool changed = false; + if (DragN(fieldLabel, componentLabels, {&values.x, &values.y}, speed, displayFormat, valueMin, valueMax, flags)) + { + changed = true; + } + + if (changed) + { + if (ImGui::IsMouseClicked(ImGuiMouseButton_Left) && !ImGui::IsMouseDragging(ImGuiMouseButton_Left)) + SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), false); + else if(ImGui::IsMouseDragging(ImGuiMouseButton_Left)) + SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), true); + else if(ImGui::IsItemDeactivatedAfterEdit()) + SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), false); + } + + return changed; } - - if (changed) + + static bool DragVec3(const std::string& fieldLabel, std::vectorconst& componentLabels, std::function get, + std::function set, float speed = 0.1f, const char* displayFormat = "%.3f", float valueMin = 0.0f, float valueMax = 0.0f, + ImGuiSliderFlags flags = 0) { - if (ImGui::IsMouseClicked(ImGuiMouseButton_Left) && !ImGui::IsMouseDragging(ImGuiMouseButton_Left)) - SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), false); - else if(ImGui::IsMouseDragging(ImGuiMouseButton_Left)) - SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), true); - else if(ImGui::IsItemDeactivatedAfterEdit()) - SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), false); + SHVec3 values = get(); + bool changed = false; + if (DragN(fieldLabel, componentLabels, {&values.x, &values.y, &values.z}, speed, displayFormat, valueMin, valueMax, flags)) + { + changed = true; + } + + if (changed) + { + if (ImGui::IsMouseDown(ImGuiMouseButton_Left) && !ImGui::IsMouseDragging(ImGuiMouseButton_Left, -0.2f)) + SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), false); + else if(ImGui::IsMouseDragging(ImGuiMouseButton_Left)) + SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), true); + else if(ImGui::IsItemDeactivatedAfterEdit()) + SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), false); + } + + return changed; } - - return changed; - } - - static bool DragVec3(const std::string& fieldLabel, std::vectorconst& componentLabels, std::function get, - std::function set, float speed = 0.1f, const char* displayFormat = "%.3f", float valueMin = 0.0f, float valueMax = 0.0f, - ImGuiSliderFlags flags = 0) - { - SHVec3 values = get(); - bool changed = false; - if (DragN(fieldLabel, componentLabels, {&values.x, &values.y, &values.z}, speed, displayFormat, valueMin, valueMax, flags)) + + static bool DragVec4(const std::string& fieldLabel, std::vectorconst& componentLabels, std::function get, + std::function set, float speed = 0.1f, const char* displayFormat = "%.3f", float valueMin = 0.0f, float valueMax = 0.0f, + ImGuiSliderFlags flags = 0) { - changed = true; + SHVec4 values = get(); + bool changed = false; + if (DragN(fieldLabel, componentLabels, {&values.x, &values.y, &values.z, &values.w}, speed, displayFormat, valueMin, valueMax, flags)) + { + changed = true; + } + + if (changed) + { + if (ImGui::IsMouseDown(ImGuiMouseButton_Left) && !ImGui::IsMouseDragging(ImGuiMouseButton_Left, -0.2f)) + SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), false); + else if(ImGui::IsMouseDragging(ImGuiMouseButton_Left)) + SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), true); + else if(ImGui::IsItemDeactivatedAfterEdit()) + SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), false); + } + + return changed; } - - if (changed) + + //#==============================================================# + //|| Widget Extensions || + //#==============================================================# + + static bool CheckBox(std::string const& label, std::function get, std::function set) { - if (ImGui::IsMouseDown(ImGuiMouseButton_Left) && !ImGui::IsMouseDragging(ImGuiMouseButton_Left, -0.2f)) - SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), false); - else if(ImGui::IsMouseDragging(ImGuiMouseButton_Left)) - SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), true); - else if(ImGui::IsItemDeactivatedAfterEdit()) - SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), false); + bool value = get(); + if (ImGui::Checkbox(label.c_str(), &value)) + { + SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), value, set)), false); + return true; + } + return false; } - - return changed; - } - - static bool DragVec4(const std::string& fieldLabel, std::vectorconst& componentLabels, std::function get, - std::function set, float speed = 0.1f, const char* displayFormat = "%.3f", float valueMin = 0.0f, float valueMax = 0.0f, - ImGuiSliderFlags flags = 0) - { - SHVec4 values = get(); - bool changed = false; - if (DragN(fieldLabel, componentLabels, {&values.x, &values.y, &values.z, &values.w}, speed, displayFormat, valueMin, valueMax, flags)) + + template + static bool RadioButton(std::vector const& listLabels, std::vector const& listTypes, std::function get, std::function set) { - changed = true; - } - - if (changed) - { - if (ImGui::IsMouseDown(ImGuiMouseButton_Left) && !ImGui::IsMouseDragging(ImGuiMouseButton_Left, -0.2f)) - SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), false); - else if(ImGui::IsMouseDragging(ImGuiMouseButton_Left)) - SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), true); - else if(ImGui::IsItemDeactivatedAfterEdit()) - SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), values, set)), false); - } - - return changed; - } - - //#==============================================================# - //|| Widget Extensions || - //#==============================================================# - - static bool CheckBox(std::string const& label, std::function get, std::function set) - { - bool value = get(); - if (ImGui::Checkbox(label.c_str(), &value)) - { - SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), value, set)), false); + T type = get(); + for (size_t i = 0; i < listTypes.size(); i++) + { + if (ImGui::RadioButton(listLabels[i].c_str(), type == listTypes[i])) + { + SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), listTypes[i], set)), false); + } + ImGui::SameLine(); + } return true; } - return false; - } - - template - static bool RadioButton(std::vector const& listLabels, std::vector const& listTypes, std::function get, std::function set) - { - T type = get(); - for (size_t i = 0; i < listTypes.size(); i++) - { - if (ImGui::RadioButton(listLabels[i].c_str(), type == listTypes[i])) - { - SHCommandManager::PerformCommand(std::reinterpret_pointer_cast(std::make_shared>(get(), listTypes[i], set)), false); - } - ImGui::SameLine(); - } - return true; - } - - - + }; }//namespace SHADE