Skip to content

Commit

Permalink
fix hello-imgui
Browse files Browse the repository at this point in the history
  • Loading branch information
LilyWangLL committed Oct 24, 2024
1 parent a8daa9e commit 9d4f74f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ports/hello-imgui/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
28 changes: 28 additions & 0 deletions ports/hello-imgui/use-new-imguiimagebutton.patch
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions ports/hello-imgui/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 9d4f74f

Please sign in to comment.