impr: Use full windows to draw tutorial popups

This commit is contained in:
WerWolv 2024-01-06 22:54:18 +01:00
parent 8042aa39bf
commit 576bc80716
1 changed files with 10 additions and 9 deletions

View File

@ -105,17 +105,18 @@ namespace hex {
windowSize.y = textSize.y + margin.y * 2; windowSize.y = textSize.y + margin.y * 2;
if (windowPos.y + windowSize.y > mainWindowPos.y + mainWindowSize.y) if (windowPos.y + windowSize.y > mainWindowPos.y + mainWindowSize.y)
windowPos.y = rect.Min.y - windowSize.y - 10_scaled; windowPos.y = rect.Min.y - windowSize.y - 15_scaled;
if (windowPos.y < mainWindowPos.y) if (windowPos.y < mainWindowPos.y)
windowPos.y = mainWindowPos.y + 10_scaled; windowPos.y = rect.Min.y + 10_scaled;
auto &style = ImGui::GetStyle(); ImGui::SetNextWindowPos(windowPos);
ImGui::SetNextWindowSize(windowSize);
ImVec2 shadowOffset = ImVec2(ImCos(style.WindowShadowOffsetAngle), ImSin(style.WindowShadowOffsetAngle)) * style.WindowShadowOffsetDist; ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID);
drawList->AddRectFilled(windowPos, windowPos + windowSize, ImGui::GetColorU32(ImGuiCol_WindowBg) | 0xFF000000); if (ImGui::Begin(unlocalizedText.c_str(), nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize)) {
drawList->AddRect(windowPos, windowPos + windowSize, ImGui::GetColorU32(ImGuiCol_Border)); ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindowRead());
drawList->AddShadowRect(windowPos, windowPos + windowSize, ImGui::GetColorU32(ImGuiCol_WindowShadow), style.WindowShadowSize, shadowOffset, ImDrawFlags_ShadowCutOutShapeBackground); ImGuiExt::TextFormattedWrapped("{}", text);
drawList->AddText(nullptr, 0.0F, windowPos + margin, ImGui::GetColorU32(ImGuiCol_Text), text, nullptr, windowSize.x - margin.x * 2); }
ImGui::End();
} }
} }
drawList->PopClipRect(); drawList->PopClipRect();