diff --git a/extensions/ImGuiEXT/CCImGuiEXT.cpp b/extensions/ImGuiEXT/CCImGuiEXT.cpp index 33bb8a6525..36bf686062 100644 --- a/extensions/ImGuiEXT/CCImGuiEXT.cpp +++ b/extensions/ImGuiEXT/CCImGuiEXT.cpp @@ -700,78 +700,4 @@ int ImGuiEXT::getCCRefId(Ref* p) return (int)hash; } -#if defined(HAVE_IMGUI_MARKDOWN) -# include "imgui_markdown/imgui_markdown.h" - -static ImGuiEXT::MdLinkCallback ImGuiMarkdownLinkCallback = nullptr; -static ImGuiEXT::MdImageCallback ImGuiMarkdownImageCallback = nullptr; -static ImGui::MarkdownImageData ImGuiMarkdownInvalidImageData = {false, false, nullptr, {0.f, 0.f}}; - -void MarkdownLinkCallback(ImGui::MarkdownLinkCallbackData data) -{ - if (ImGuiMarkdownLinkCallback) - { - ImGuiMarkdownLinkCallback({data.text, (size_t)data.textLength}, {data.link, (size_t)data.linkLength}, - data.isImage); - } -} - -ImGui::MarkdownImageData MarkdownImageCallback(ImGui::MarkdownLinkCallbackData data) -{ - if (!data.isImage || !ImGuiMarkdownImageCallback) - return ImGuiMarkdownInvalidImageData; - Sprite* sp; - ImVec2 size; - ImVec4 tint_col; - ImVec4 border_col; - std::tie(sp, size, tint_col, border_col) = - ImGuiMarkdownImageCallback({data.text, (size_t)data.textLength}, {data.link, (size_t)data.linkLength}); - if (!sp || !sp->getTexture()) - return ImGuiMarkdownInvalidImageData; - auto size_ = size; - const auto rect = sp->getTextureRect(); - if (size_.x <= 0.f) - size_.x = rect.size.width; - if (size_.y <= 0.f) - size_.y = rect.size.height; - ImVec2 uv0, uv1; - std::tie(uv0, uv1) = getTextureUV(sp); - ImGuiEXT::getInstance()->getCCRefId(sp); - return {true, true, (ImTextureID)sp->getTexture(), size_, uv0, uv1, tint_col, border_col}; -} - -static std::string ImGuiMarkdownLinkIcon; -static ImGui::MarkdownConfig ImGuiMarkdownConfig = {MarkdownLinkCallback, MarkdownImageCallback, ""}; - -void ImGuiEXT::setMarkdownLinkCallback(const MdLinkCallback& f) -{ - ImGuiMarkdownLinkCallback = f; -} - -void ImGuiEXT::setMarkdownImageCallback(const MdImageCallback& f) -{ - ImGuiMarkdownImageCallback = f; -} - -void ImGuiEXT::setMarkdownFont(int index, ImFont* font, bool seperator, float scale) -{ - if (index < 0 || index >= ImGui::MarkdownConfig::NUMHEADINGS) - return; - ImGuiMarkdownConfig.headingFormats[index] = {font, seperator}; - ImGuiMarkdownConfig.headingScales[index] = scale; -} - -void ImGuiEXT::setMarkdownLinkIcon(std::string_view icon) -{ - ImGuiMarkdownLinkIcon = icon; - ImGuiMarkdownConfig.linkIcon = ImGuiMarkdownLinkIcon.c_str(); -} - -void ImGuiEXT::markdown(std::string_view content) -{ - ImGui::Markdown(content.c_str(), content.size(), ImGuiMarkdownConfig); -} - -#endif - NS_CC_EXT_END diff --git a/extensions/ImGuiEXT/CCImGuiEXT.h b/extensions/ImGuiEXT/CCImGuiEXT.h index c03cddc0c2..01508729c3 100644 --- a/extensions/ImGuiEXT/CCImGuiEXT.h +++ b/extensions/ImGuiEXT/CCImGuiEXT.h @@ -116,20 +116,6 @@ public: static void mergeFontGlyphs(ImFont* dst, ImFont* src, ImWchar start, ImWchar end); int getCCRefId(Ref* p); -#if defined(HAVE_IMGUI_MARKDOWN) - // markdown - - using MdLinkCallback = std::function; - using MdImageCallback = - std::function(const std::string&, const std::string&)>; - - void setMarkdownLinkCallback(const MdLinkCallback& f); - void setMarkdownImageCallback(const MdImageCallback& f); - void setMarkdownFont(int index, ImFont* font, bool seperator, float scale = 1.f); - void setMarkdownLinkIcon(std::string_view icon); - void markdown(std::string_view content); -#endif - private: static void loadCustomFonts(void*); diff --git a/extensions/assets-manager/AssetsManagerEx.cpp b/extensions/assets-manager/AssetsManagerEx.cpp index 8636f4523e..22bf8ef3b4 100644 --- a/extensions/assets-manager/AssetsManagerEx.cpp +++ b/extensions/assets-manager/AssetsManagerEx.cpp @@ -803,7 +803,7 @@ void AssetsManagerEx::startUpdate() Manifest::AssetDiff diff = it->second; if (diff.type != Manifest::DiffType::DELETED) { - const std::string& path = diff.asset.path; + auto& path = diff.asset.path; DownloadUnit unit; unit.customId = it->first; unit.srcUrl = packageUrl;