From 9d4f74fe51337512daacb2cb158639622324812f Mon Sep 17 00:00:00 2001 From: LilyWangLL <4945507022qq.com> Date: Wed, 23 Oct 2024 19:22:12 -0700 Subject: [PATCH] fix hello-imgui --- ports/hello-imgui/portfile.cmake | 4 ++- .../use-new-imguiimagebutton.patch | 28 +++++++++++++++++++ ports/hello-imgui/vcpkg.json | 1 + 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 ports/hello-imgui/use-new-imguiimagebutton.patch diff --git a/ports/hello-imgui/portfile.cmake b/ports/hello-imgui/portfile.cmake index 64926f2767c5d7..175e5926d20183 100644 --- a/ports/hello-imgui/portfile.cmake +++ b/ports/hello-imgui/portfile.cmake @@ -8,6 +8,7 @@ vcpkg_from_github( HEAD_REF master PATCHES fix-upw.patch + use-new-imguiimagebutton.patch # Upstream commit: https://github.com/pthom/hello_imgui/commit/3ba369ad5b9bc281f01a2b2ee78d64ecef7d632a ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS @@ -55,7 +56,8 @@ endif() vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" + DISABLE_PARALLEL_CONFIGURE + SOURCE_PATH "${SOURCE_PATH}" OPTIONS -DHELLOIMGUI_BUILD_DEMOS=OFF -DHELLOIMGUI_BUILD_DOCS=OFF diff --git a/ports/hello-imgui/use-new-imguiimagebutton.patch b/ports/hello-imgui/use-new-imguiimagebutton.patch new file mode 100644 index 00000000000000..061ad102a7b3f0 --- /dev/null +++ b/ports/hello-imgui/use-new-imguiimagebutton.patch @@ -0,0 +1,28 @@ +diff --git a/src/hello_imgui/internal/image_from_asset.cpp b/src/hello_imgui/internal/image_from_asset.cpp +index 7416a69..7151e2f 100644 +--- a/src/hello_imgui/internal/image_from_asset.cpp ++++ b/src/hello_imgui/internal/image_from_asset.cpp +@@ -116,7 +116,7 @@ namespace HelloImGui + auto textureId = cachedImage->TextureID(); + auto imageSize = ImVec2((float)cachedImage->Width, (float)cachedImage->Height); + ImVec2 displayedSize = ImageProportionalSize(size, imageSize); +- bool clicked = ImGui::ImageButton(textureId, displayedSize, uv0, uv1, frame_padding, bg_col, tint_col); ++ bool clicked = ImGui::ImageButton(assetPath, textureId, displayedSize, uv0, uv1, bg_col, tint_col); + return clicked; + } + +diff --git a/src/hello_imgui/internal/image_gl_deprecated.cpp b/src/hello_imgui/internal/image_gl_deprecated.cpp +index 5c66c24..98d21d5 100644 +--- a/src/hello_imgui/internal/image_gl_deprecated.cpp ++++ b/src/hello_imgui/internal/image_gl_deprecated.cpp +@@ -67,7 +67,9 @@ bool ImageGl::DrawButton( + const ImVec4& tint_col) + { + ImVec2 displayedSize = ImageProportionalSize(size, this->imageSize); +- return ImGui::ImageButton(this->imTextureId, displayedSize, uv0, uv1, frame_padding, bg_col, tint_col); ++ char str_id[64]; ++ snprintf(str_id, 64, "ImageButton_%p", this->imTextureId); ++ return ImGui::ImageButton(str_id, this->imTextureId, displayedSize, uv0, uv1, bg_col, tint_col); + } + + ImageGlPtr ImageGl::FactorImage(const char *assetPath) diff --git a/ports/hello-imgui/vcpkg.json b/ports/hello-imgui/vcpkg.json index 4e4636a811c192..2668dafe4b05a0 100644 --- a/ports/hello-imgui/vcpkg.json +++ b/ports/hello-imgui/vcpkg.json @@ -1,6 +1,7 @@ { "name": "hello-imgui", "version": "1.5.2", + "port-version": 1, "description": "Hello ImGui: unleash your creativity in app development and prototyping", "homepage": "https://pthom.github.io/hello_imgui/", "license": "MIT",