vcpkg/ports/imgui-sfml/0003-use-explicit-id.patch
2024-11-22 15:21:15 -08:00

112 lines
6.4 KiB
Diff

diff --git a/imgui-SFML.cpp b/imgui-SFML.cpp
index 6ae99c1..069fdeb 100644
--- a/imgui-SFML.cpp
+++ b/imgui-SFML.cpp
@@ -984,49 +984,30 @@ void Image(const sf::Sprite& sprite, const sf::Vector2f& size, const sf::Color&
/////////////// Image Button Overloads for sf::Texture
-bool ImageButton(const sf::Texture& texture, const int framePadding, const sf::Color& bgColor,
- const sf::Color& tintColor) {
- return ImageButton(texture, static_cast<sf::Vector2f>(texture.getSize()), framePadding, bgColor,
- tintColor);
-}
-
-bool ImageButton(const sf::Texture& texture, const sf::Vector2f& size, const int framePadding,
+bool ImageButton(const char* id, const sf::Texture& texture, const sf::Vector2f& size,
const sf::Color& bgColor, const sf::Color& tintColor) {
ImTextureID textureID = convertGLTextureHandleToImTextureID(texture.getNativeHandle());
- return ImGui::ImageButton(textureID, ImVec2(size.x, size.y), ImVec2(0, 0), ImVec2(1, 1),
- framePadding, toImColor(bgColor), toImColor(tintColor));
+ return ImGui::ImageButton(id, textureID, ImVec2(size.x, size.y), ImVec2(0, 0), ImVec2(1, 1),
+ toImColor(bgColor), toImColor(tintColor));
}
/////////////// Image Button Overloads for sf::RenderTexture
-bool ImageButton(const sf::RenderTexture& texture, const int framePadding, const sf::Color& bgColor,
- const sf::Color& tintColor) {
- return ImageButton(texture, static_cast<sf::Vector2f>(texture.getSize()), framePadding, bgColor,
- tintColor);
-}
-
-bool ImageButton(const sf::RenderTexture& texture, const sf::Vector2f& size, const int framePadding,
+bool ImageButton(const char* id, const sf::RenderTexture& texture, const sf::Vector2f& size,
const sf::Color& bgColor, const sf::Color& tintColor) {
ImTextureID textureID =
convertGLTextureHandleToImTextureID(texture.getTexture().getNativeHandle());
- return ImGui::ImageButton(textureID, ImVec2(size.x, size.y), ImVec2(0, 1),
+ return ImGui::ImageButton(id, textureID, ImVec2(size.x, size.y), ImVec2(0, 1),
ImVec2(1, 0), // flipped vertically, because textures in
// sf::RenderTexture are stored this way
- framePadding, toImColor(bgColor), toImColor(tintColor));
+ toImColor(bgColor), toImColor(tintColor));
}
/////////////// Image Button Overloads for sf::Sprite
-bool ImageButton(const sf::Sprite& sprite, const int framePadding, const sf::Color& bgColor,
- const sf::Color& tintColor) {
- sf::FloatRect spriteSize = sprite.getGlobalBounds();
- return ImageButton(sprite, sf::Vector2f(spriteSize.width, spriteSize.height), framePadding,
- bgColor, tintColor);
-}
-
-bool ImageButton(const sf::Sprite& sprite, const sf::Vector2f& size, const int framePadding,
+bool ImageButton(const char* id, const sf::Sprite& sprite, const sf::Vector2f& size,
const sf::Color& bgColor, const sf::Color& tintColor) {
#if SFML_VERSION_MAJOR >= 3
const sf::Texture& texture = sprite.getTexture();
@@ -1045,8 +1026,8 @@ bool ImageButton(const sf::Sprite& sprite, const sf::Vector2f& size, const int f
(textureRect.top + textureRect.height) / textureSize.y);
ImTextureID textureID = convertGLTextureHandleToImTextureID(texture.getNativeHandle());
- return ImGui::ImageButton(textureID, ImVec2(size.x, size.y), uv0, uv1, framePadding,
- toImColor(bgColor), toImColor(tintColor));
+ return ImGui::ImageButton(id, textureID, ImVec2(size.x, size.y), uv0, uv1, toImColor(bgColor),
+ toImColor(tintColor));
}
/////////////// Draw_list Overloads
diff --git a/imgui-SFML.h b/imgui-SFML.h
index e431e99..8cce4d6 100644
--- a/imgui-SFML.h
+++ b/imgui-SFML.h
@@ -99,29 +99,19 @@ IMGUI_SFML_API void Image(const sf::Sprite& sprite, const sf::Vector2f& size,
const sf::Color& borderColor = sf::Color::Transparent);
// ImageButton overloads for sf::Texture
-IMGUI_SFML_API bool ImageButton(const sf::Texture& texture, const int framePadding = -1,
- const sf::Color& bgColor = sf::Color::Transparent,
- const sf::Color& tintColor = sf::Color::White);
-IMGUI_SFML_API bool ImageButton(const sf::Texture& texture, const sf::Vector2f& size,
- const int framePadding = -1,
+IMGUI_SFML_API bool ImageButton(const char* id, const sf::Texture& texture,
+ const sf::Vector2f& size,
const sf::Color& bgColor = sf::Color::Transparent,
const sf::Color& tintColor = sf::Color::White);
// ImageButton overloads for sf::RenderTexture
-IMGUI_SFML_API bool ImageButton(const sf::RenderTexture& texture, const int framePadding = -1,
- const sf::Color& bgColor = sf::Color::Transparent,
- const sf::Color& tintColor = sf::Color::White);
-IMGUI_SFML_API bool ImageButton(const sf::RenderTexture& texture, const sf::Vector2f& size,
- const int framePadding = -1,
+IMGUI_SFML_API bool ImageButton(const char* id, const sf::RenderTexture& texture,
+ const sf::Vector2f& size,
const sf::Color& bgColor = sf::Color::Transparent,
const sf::Color& tintColor = sf::Color::White);
// ImageButton overloads for sf::Sprite
-IMGUI_SFML_API bool ImageButton(const sf::Sprite& sprite, const int framePadding = -1,
- const sf::Color& bgColor = sf::Color::Transparent,
- const sf::Color& tintColor = sf::Color::White);
-IMGUI_SFML_API bool ImageButton(const sf::Sprite& sprite, const sf::Vector2f& size,
- const int framePadding = -1,
+IMGUI_SFML_API bool ImageButton(const char* id, const sf::Sprite& sprite, const sf::Vector2f& size,
const sf::Color& bgColor = sf::Color::Transparent,
const sf::Color& tintColor = sf::Color::White);