tenho seguinte código c++ void CWindow::CreateChild(const std::string& title, const…
- User
tenho seguinte código c++
void CWindow::CreateChild(const std::string& title, const ImVec2& size, const ImVec4& color, const ImVec4& borderColor, float rounding, RenderPosition position, float horizontalDistance, float topDistance, const std::function<void()>& onRender) { ImGui::PushStyleColor(ImGuiCol_ChildBg, color); ImGui::PushStyleColor(ImGuiCol_Border, borderColor); ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, rounding); ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 1.0f);
codeImVec2 parentPos = ImGui::GetWindowPos(); ImVec2 parentSize = ImGui::GetWindowSize(); ImVec2 childPos; switch (position) { case RenderPosition::CENTER: childPos = ImVec2(parentPos.x + (parentSize.x - size.x) / 2, parentPos.y + topDistance); break; case RenderPosition::RIGHT: childPos = ImVec2(parentPos.x + parentSize.x - size.x - horizontalDistance, parentPos.y + topDistance); break; case RenderPosition::LEFT: childPos = ImVec2(parentPos.x + horizontalDistance, parentPos.y + topDistance); break; } ImGui::SetCursorScreenPos(childPos); ImGui::BeginChild(title.c_str(), size, true, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar); if (onRender) { onRender(); } ImGui::PopStyleVar(2); ImGui::PopStyleColor(2); ImGui::EndChild(); ImGui::SetCursorScreenPos(ImVec2(childPos.x + size.x + horizontalDistance, childPos.y));}
void CWindow::TitleBar(float height, float topRadius, const ImVec4& bgColor, const ImVec4& borderColor) { ImVec2 windowPos = ImGui::GetWindowPos(); ImVec2 windowSize = ImGui::GetWindowSize();
code - Assistant