|
|
|
@ -77,6 +77,93 @@ namespace lunarium
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::PopID();
|
|
|
|
ImGui::PopID();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ImGuiExt::Vec2Control(const std::string& label, glm::vec3& values, float resetValue, float columnWidth)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ImGui::PushID(label.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::Columns(2);
|
|
|
|
|
|
|
|
ImGui::SetColumnWidth(0, columnWidth);
|
|
|
|
|
|
|
|
ImGui::Text(label.c_str());
|
|
|
|
|
|
|
|
ImGui::NextColumn();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
|
|
|
|
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ 0, 0 });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float lineHeight = GImGui->Font->FontSize + GImGui->Style.FramePadding.y * 2.0f;
|
|
|
|
|
|
|
|
ImVec2 buttonSize = { lineHeight + 3.0f, lineHeight };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4{ 0.8f, 0.1f, 0.15f, 1.0f });
|
|
|
|
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4{ 0.9f, 0.2f, 0.2f, 1.0f });
|
|
|
|
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4{ 0.8f, 0.1f, 0.15f, 1.0f });
|
|
|
|
|
|
|
|
//ImGui::PushFont(boldFont);
|
|
|
|
|
|
|
|
if (ImGui::Button("X", buttonSize))
|
|
|
|
|
|
|
|
values.x = resetValue;
|
|
|
|
|
|
|
|
//ImGui::PopFont();
|
|
|
|
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
|
|
|
ImGui::DragFloat("##X", &values.x, 0.1f, 0.0f, 0.0f, "%.2f");
|
|
|
|
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4{ 0.2f, 0.7f, 0.2f, 1.0f });
|
|
|
|
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4{ 0.3f, 0.8f, 0.3f, 1.0f });
|
|
|
|
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4{ 0.2f, 0.7f, 0.2f, 1.0f });
|
|
|
|
|
|
|
|
//ImGui::PushFont(boldFont);
|
|
|
|
|
|
|
|
if (ImGui::Button("Y", buttonSize))
|
|
|
|
|
|
|
|
values.y = resetValue;
|
|
|
|
|
|
|
|
//ImGui::PopFont();
|
|
|
|
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
|
|
|
ImGui::DragFloat("##Y", &values.y, 0.1f, 0.0f, 0.0f, "%.2f");
|
|
|
|
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::Columns(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::PopID();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ImGuiExt::FloatControl(const std::string& label, float& value, float resetValue, float columnWidth)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ImGui::PushID(label.c_str());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::Columns(2);
|
|
|
|
|
|
|
|
ImGui::SetColumnWidth(0, columnWidth);
|
|
|
|
|
|
|
|
ImGui::Text(label.c_str());
|
|
|
|
|
|
|
|
ImGui::NextColumn();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth());
|
|
|
|
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ 0, 0 });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float lineHeight = GImGui->Font->FontSize + GImGui->Style.FramePadding.y * 2.0f;
|
|
|
|
|
|
|
|
ImVec2 buttonSize = { lineHeight + 3.0f, lineHeight };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4{ 0.8f, 0.1f, 0.15f, 1.0f });
|
|
|
|
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4{ 0.9f, 0.2f, 0.2f, 1.0f });
|
|
|
|
|
|
|
|
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4{ 0.8f, 0.1f, 0.15f, 1.0f });
|
|
|
|
|
|
|
|
//ImGui::PushFont(boldFont);
|
|
|
|
|
|
|
|
if (ImGui::Button("R", buttonSize))
|
|
|
|
|
|
|
|
value = resetValue;
|
|
|
|
|
|
|
|
//ImGui::PopFont();
|
|
|
|
|
|
|
|
ImGui::PopStyleColor(3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
|
|
|
ImGui::DragFloat("##X", &value, 0.1f, 0.0f, 0.0f, "%.2f");
|
|
|
|
|
|
|
|
ImGui::PopItemWidth();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::Columns(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGui::PopID();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Only works if this is the only item on the line
|
|
|
|
/// Only works if this is the only item on the line
|
|
|
|
void ImGuiExt::TextCentered(const std::string text)
|
|
|
|
void ImGuiExt::TextCentered(const std::string text)
|
|
|
|
|