impr: Added hint when patterns are still loading

This commit is contained in:
WerWolv
2023-08-30 10:04:06 +02:00
parent 60649d1cba
commit 58cef2361b
4 changed files with 19 additions and 0 deletions

View File

@@ -245,4 +245,5 @@ namespace ImGui {
bool DimmedIconButton(const char *symbol, ImVec4 color, ImVec2 size_arg = ImVec2(0, 0));
bool DimmedIconToggle(const char *icon, bool *v);
void TextOverlay(const char *text, ImVec2 pos);
}

View File

@@ -810,4 +810,17 @@ namespace ImGui {
return toggled;
}
void TextOverlay(const char *text, ImVec2 pos) {
const auto textSize = ImGui::CalcTextSize(text);
const auto textPos = pos - textSize / 2;
const auto margin = ImGui::GetStyle().FramePadding * 2;
const auto textRect = ImRect(textPos - margin, textPos + textSize + margin);
auto drawList = ImGui::GetForegroundDrawList();
drawList->AddRectFilled(textRect.Min, textRect.Max, ImGui::GetColorU32(ImGuiCol_WindowBg) | 0xFF000000);
drawList->AddRect(textRect.Min, textRect.Max, ImGui::GetColorU32(ImGuiCol_Border));
drawList->AddText(textPos, ImGui::GetColorU32(ImGuiCol_Text), text);
}
}